Negative sleep time and tasks schedule stale
Got this log output yesterday and all scheduled task are stale until periodiq restarted.
[2019-10-29 20:05:00,063] [PID 1] [MainThread] [periodiq] [DEBUG] Nothing to do until 2019-10-29T20:06:00+03:00.
[2019-10-29 20:05:00,064] [PID 1] [MainThread] [periodiq] [DEBUG] Sleeping for 59s (<Period [2019-10-29T20:05:00.064172+03:00 -> 2019-10-29T20:06:00+03:00]>).
[2019-10-29 20:06:01,030] [PID 1] [MainThread] [periodiq] [DEBUG] Alaaaaarm!
[2019-10-29 20:06:10,733] [PID 1] [MainThread] [periodiq] [DEBUG] Wake up at 2019-10-29T20:06:08+03:00.
[2019-10-29 20:06:11,183] [PID 1] [MainThread] [periodiq] [INFO] Scheduling Actor(task_func1) at 2019-10-29T20:06:08+03:00.
[2019-10-29 20:06:11,726] [PID 1] [MainThread] [dramatiq.broker.RedisBroker] [DEBUG] Enqueueing message 'd6752455-19b6-4266-995c-6fc1f7b0561f' on queue 'default'.
[2019-10-29 20:07:00,724] [PID 1] [MainThread] [django_dramatiq.AdminMiddleware] [DEBUG] Creating Task from message 'd6752455-19b6-4266-995c-6fc1f7b0561f'.
[2019-10-29 20:07:36,910] [PID 1] [MainThread] [periodiq] [INFO] Scheduling Actor(tasks_scheduler) at 2019-10-29T20:06:08+03:00.
[2019-10-29 20:07:36,914] [PID 1] [MainThread] [dramatiq.broker.RedisBroker] [DEBUG] Enqueueing message '08d18b45-adc9-42b1-8c84-a747b6bea4f1' on queue 'default'.
[2019-10-29 20:07:36,928] [PID 1] [MainThread] [django_dramatiq.AdminMiddleware] [DEBUG] Creating Task from message '08d18b45-adc9-42b1-8c84-a747b6bea4f1'.
[2019-10-29 20:07:36,997] [PID 1] [MainThread] [periodiq] [INFO] Scheduling Actor(task_func2) at 2019-10-29T20:06:08+03:00.
[2019-10-29 20:07:36,999] [PID 1] [MainThread] [dramatiq.broker.RedisBroker] [DEBUG] Enqueueing message '0697be08-2e0a-45f2-97ab-2c4d69e78bfc' on queue 'heavy'.
[2019-10-29 20:07:37,005] [PID 1] [MainThread] [django_dramatiq.AdminMiddleware] [DEBUG] Creating Task from message '0697be08-2e0a-45f2-97ab-2c4d69e78bfc'.
[2019-10-29 20:07:37,062] [PID 1] [MainThread] [periodiq] [DEBUG] Nothing to do until 2019-10-29T20:07:00+03:00.
[2019-10-29 20:07:37,085] [PID 1] [MainThread] [periodiq] [DEBUG] Sleeping for -37s (<Period [2019-10-29T20:07:37.064308+03:00 -> 2019-10-29T20:07:00+03:00]>).
Edited by sovetnikov