Skip to content

Commit

Permalink
added task for run job
Browse files Browse the repository at this point in the history
  • Loading branch information
OlegPhenomenon committed Jul 12, 2023
1 parent 6dd5635 commit 02671f1
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions lib/tasks/check_for_company_status.rake
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

0 comments on commit 02671f1

Please sign in to comment.