I am working on ROR application. i have a functionality requirement, where i have to call a method for every 30 seconds using sidekiq
and i am using these gems
# sidekiq
gem 'sidekiq', '~> 3.3.0'
# sidekiq scheduler
gem 'sidekiq-scheduler', '~> 2.0'
here is my scheduler.yml file code.
perform:
every: ["30s"]
class: Aggregator
queue: aggregation
description: "This job will create Aggregate data."
here is my Aggregator class which inside the Workers folder.
class Aggregator
include Sidekiq::Worker
sidekiq_options :backtrace => 5, :retry => false
def perform
end_time = time - (time.sec%30).seconds
puts "ROUNDING TO 30 SEC"
puts end_time
Session.create_aggregate_data(end_time)
end
end
when i am checking the sidekiq logs it's not hitting the perform method. but the Aggregator class is getting called
here are the logs..
2016-07-27T10:19:59.436Z 15117 TID-1qjnlu INFO: queueing Aggregator (perform)
2016-07-27T10:20:29.641Z 15117 TID-1qjnlu INFO: queueing Aggregator (perform)
2016-07-27T10:20:59.836Z 15117 TID-1qjnlu INFO: queueing Aggregator (perform)
2016-07-27T10:21:30.009Z 15117 TID-1qjnlu INFO: queueing Aggregator (perform)
2016-07-27T10:22:00.204Z 15117 TID-1qjnlu INFO: queueing Aggregator (perform)
2016-07-27T10:22:30.507Z 15117 TID-1qjnlu INFO: queueing Aggregator (perform)
2016-07-27T10:23:00.509Z 15117 TID-1qjnlu INFO: queueing Aggregator (perform)
2016-07-27T10:23:30.760Z 15117 TID-1qjnlu INFO: queueing Aggregator (perform)
2016-07-27T10:24:01.068Z 15117 TID-1qjnlu INFO: queueing Aggregator (perform)
Try to set queue to default if you didn't configure non-default queues
queue: default