-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6dd5635
commit 02671f1
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
require 'optparse' | ||
require 'rake_option_parser_boilerplate' | ||
require 'syslog/logger' | ||
require 'active_record' | ||
|
||
DAYS_INTERVAL = 365 | ||
SPAM_TIME_DELAY = 0.3 | ||
BATCH_SIZE = 100 | ||
|
||
namespace :company_status do | ||
# bundle exec rake company_status:check_all -- --days_interval=128 --spam_time_delay=0.3 --batch_size=100 | ||
|
||
desc 'Starts verifying registrant companies job with optional days interval, spam time delay and batch size' | ||
task check_all: :environment do | ||
options = { | ||
days_interval: DAYS_INTERVAL, | ||
spam_time_delay: SPAM_TIME_DELAY, | ||
batch_size: BATCH_SIZE, | ||
} | ||
|
||
opts_hash = { | ||
days_interval: ["--days_interval=VALUE", Integer], | ||
spam_time_delay: ["--spam_time_delay=VALUE", Float], | ||
batch_size: ["--batch_size=VALUE", Integer] | ||
} | ||
|
||
banner = 'Usage: rake company_status:check_all -- [options]' | ||
options = RakeOptionParserBoilerplate.process_args(options: options, | ||
banner: banner, | ||
hash: opts_hash) | ||
|
||
|
||
CompanyRegisterStatusJob.perform_later(options[:days_interval], options[:spam_time_delay], options[:batch_size]) | ||
end | ||
end |