seomoz / qless-core

Core Lua Scripts for qless
MIT License
85 stars 33 forks source link

Clarification on how scheduled dates are calculated #47

Closed StephenOTT closed 10 years ago

StephenOTT commented 10 years ago

https://github.com/seomoz/qless-core/blob/244cf5cb6167ed768548a01ef48d3d6774663ab4/job.lua#L180

Want to confirm that this line is indicating that the scheduled date is calculated by the Now dateTime + the number of seconds for the delay resulting in future date.

I am looking at adding the ability to schedule a job based on a future date/time. From the looks of it, this is "technically" already supported. Just to need pre-calculate the difference between now and the future date in seconds and submit that as the delay.

(is there also persistence for these future dates even if the whole stack is shutdown for a period of time)

Is my thinking correct on this?

Thanks

this is related to: https://github.com/seomoz/qless/issues/185

StephenOTT commented 10 years ago

(is there also persistence for these future dates even if the whole stack is shutdown for a period of time)

Persistence question has been answered with a "yes". Tested and does work. So current work around is to calculate difference in seconds between now and future date and use that as delay.

dlecocq commented 10 years ago

Yes, scheduled jobs are implemented as the current timestamp plus a delay.

The persistence depends on your redis configuration. By default, redis does save to disk, making it durable, but it is also possible to configure it to only persist in memory.

StephenOTT commented 10 years ago

Thanks