heroku - Ruby on Rails execute recurring task -
i need perform task every 1 minute on rails application. far have tried delayed job (scheduling job every minute rails 3.1 on heroku) no success (runs 1 time , stopped) , right i'm trying sidetiq gem (https://github.com/endofunky/sidetiq).
i have installed gem , created file
/config/initializers/sidetiq_test.rb
here's code put inside:
class myworker include sidekiq::worker include sidetiq::schedulable recurrence { hourly.minute_of_hour(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60) } def perform p '####################################' p 'clients' end end
i perform task in official version insterted couple of prints. have restarted server, no errors nothing happens, know missing?
one last note: solution must heroku compatible, because don't have access crontab.
more 1 solution this, 1 thing use clockwork scheduling sidekiq recurring task. it's simple setup , easy use: https://github.com/tomykaira/clockwork
Comments
Post a Comment