Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
veNJOB
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Thanh Hung Pham
veNJOB
Commits
6ab9a5d1
Commit
6ab9a5d1
authored
Jul 04, 2017
by
Thanh Hung Pham
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Config autoload file and schedule content update
parent
95480c2e
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
3 additions
and
3 deletions
+3
-3
config/schedule.rb
+1
-0
lib/import/csv_reader.rb
+1
-1
lib/tasks/import_csv.rake
+1
-2
No files found.
config/schedule.rb
View file @
6ab9a5d1
...
@@ -24,4 +24,5 @@ set :output, { error: 'log/cron_error_log.log', standard: 'log/cron_log.log' }
...
@@ -24,4 +24,5 @@ set :output, { error: 'log/cron_error_log.log', standard: 'log/cron_log.log' }
every
1
.
day
,
at:
'12:00 pm'
do
every
1
.
day
,
at:
'12:00 pm'
do
rake
'crawler:load'
rake
'crawler:load'
rake
'import:csv'
end
end
lib/
tasks
/csv_reader.rb
→
lib/
import
/csv_reader.rb
View file @
6ab9a5d1
...
@@ -2,7 +2,7 @@ require 'thread'
...
@@ -2,7 +2,7 @@ require 'thread'
require
'logger'
require
'logger'
require
'csv'
require
'csv'
class
CSVReader
class
Import
::
CSVReader
attr_reader
:thread_count
,
:logger
attr_reader
:thread_count
,
:logger
def
initialize
(
file
,
thread_count
)
def
initialize
(
file
,
thread_count
)
...
...
lib/tasks/import_csv.rake
View file @
6ab9a5d1
...
@@ -5,7 +5,6 @@ require 'zip'
...
@@ -5,7 +5,6 @@ require 'zip'
namespace
:import
do
namespace
:import
do
desc
'Import CSV'
desc
'Import CSV'
task
csv: :environment
do
task
csv: :environment
do
require
"
#{
Rails
.
root
}
/lib/tasks/csv_reader"
thread_count
=
ENV
[
'THREAD_COUNT'
]
||
1
thread_count
=
ENV
[
'THREAD_COUNT'
]
||
1
ftp
=
Net
::
FTP
.
new
ftp
=
Net
::
FTP
.
new
...
@@ -28,7 +27,7 @@ namespace :import do
...
@@ -28,7 +27,7 @@ namespace :import do
end
end
end
end
CSVReader
.
new
(
path_csv
,
thread_count
).
import
Import
::
CSVReader
.
new
(
path_csv
,
thread_count
).
import
File
.
delete
(
path_zip
)
File
.
delete
(
path_zip
)
File
.
delete
(
path_csv
)
File
.
delete
(
path_csv
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment