由sidekiq-schedular宝石构建的cron作业在某些运行时间后无法正常工作
在sidekiq.log中显示如下日志后,由sidekiq-schedular建立的cron作业不起作用,我认为cron作业无法实现计算机分配的资源,并且sidekiq将杀死cron作业进程,以便cron工作无效。
log:
2019-01-02T05:59:31.402Z 17661 TID-1qh5n8 xxWorker JID-
3fd2a752534605ea95f0da18 INFO: done: 310.201 sec
2019-01-02T05:59:34.602Z 17661 TID-nq9os INFO: queueing xxOrder (xx_order)
2019-01-02T05:59:39.201Z 17661 TID-otug72bxs WARN:
ActiveRecord::ConnectionTimeoutError: could not obtain a database connection
within 5.000 seconds (waited 25.199 seconds)
2019-01-02T05:59:43.900Z 17661 TID-otu6vmaf8 WARN:
ActiveRecord::ConnectionTimeoutError: could not obtain a database connection
within 5.000 seconds (waited 8.101 seconds)
2019-01-02T05:59:56.103Z 17661 TID-25g3b8 INFO: queueing xxCourse
(xx_course)
2019-01-02T05:59:52.501Z 17661 TID-1yfkgo xxWorker JID-
7610c466719b1a3b73d2228c INFO: done: 340.701 sec
2019-01-02T05:59:56.296Z 17661 TID-otuf74njo xxWorker JID-
35b4c1ad43b7aa046c9cfd15 INFO: done: 343.302 sec
2019-01-02T06:00:05.999Z 17661 TID-27ixhs xxWorker JID-
f8f753cd80ac740a3f603188
INFO: done: 168.404 sec
code:
Time.now => "2019-01-03 17:10:00"
SidekiqScheduler::RedisManager.get_job_last_time("xxx_job") => "2019-01-02 16:09:00"
# 'xxx_job' queue not work and the next time is not "2019-01-03 17:11:00"
SidekiqScheduler::RedisManager.get_job_next_time("xxx_job") => "2019-01-02 16:10:00"
在工作不正常时如何激活cron任务,谢谢!