javan / whenever

Cron jobs in Ruby
MIT License
8.83k stars 726 forks source link

Action Cable with whenever not working #722

Open bpdarlyn opened 7 years ago

bpdarlyn commented 7 years ago

I am doing a application with redis-server but when I do broadcast from my schedule.rb the output console say than It has been send, but never my action cable receive. this is my file

# schedule.rb
ENV.each { |k, v| env(k, v) }
every '*/3 * * * *' do
    runner "Driver.check_driver_logged",:environment => 'development'
end
# file converted to crontab
*/3 * * * * /bin/bash -l -c 'cd /home/bpdarlyn/proyectos/trackdio_web && bundle exec bin/rails runner -e development '\''Driver.check_driver_logged'\'' >> ~/proyectos/trackdio_web/log/cron_log.log 2>&1'
# this method is executed on Driver.check_driver_logged
ActionCable.server.broadcast "#{tenant}", tracking.try(:driver).try(:prepare_marker_drive)

do you have any idea why the broadcast method no send streaming from crontab ?

zmcNotafraid commented 7 years ago

I use whenever with websocket-client-simple gem.It's also not working.But I add 「sleep 5」 at model method last. It's fine.You could try in your check_driver_logged method.