smith-carson/phalcon-queue-db

Implement TTR

Opened this issue · 0 comments

Currently there's no implementation of time-to-run hooks. Jobs may timeout and we will never know?

Possible implementation: when a job is reserved, turn the delay into ttr: if there's no TTR, delay becomes zero; if there's TTR, delay becomes time()+TTR. Finally, peeks/reserves will return jobs with state=reserved AND delay<time(), but won't return any reserved job with delay=0 - meaning a job that gets reserved with no timeout will be reserved only once, but if it's reserved with a timeout and it expires, it can be reserved again, and if it's ready, it can be reserved as soon as its delay expired.

  • implement TTR behaviour
  • implement Job::touch()
  • include this on tests