Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Longer Delays #785

Closed
j opened this issue Dec 22, 2015 · 3 comments
Closed

Longer Delays #785

j opened this issue Dec 22, 2015 · 3 comments
Labels

Comments

@j
Copy link

j commented Dec 22, 2015

So the documentation about delays say to pass in milliseconds and it creates times and processes up to 1000, etc, etc. Which doesn't sound too hot for a lot of delays scheduled further in the future.

Basically, can I create longer delays?

Here's my (example) use-case:

For every user that signs up, I'll create a delayed job to be processed in 30 minutes, I want to process certain things (i.e. pull updated info from 3rd party API), then re-schedule the same job for another 30 minutes later. I'll do 30 minute intervals for the first 7 days, then I'll change the delay to, lets say, 1 full day after that.

An alternative to this type of use-case would be for every user sign up, create all the events to be processed in the future. 30 minutes from now, 1 hr, 1:30, 2:00, 2:30... (for a whole week), then switch to one a day after that for a whole week. (essentially creating around 343 scheduled future jobs for every user sign up right off the bat).

Can Kue handle a large amount of delayed queues like this?

@behrad
Copy link
Collaborator

behrad commented Dec 23, 2015

No difference, you can simply do .delay( 24 * 60 * 60 * 1000 ) for a 24h delay :)
You can also update job delay as wanted: job.delay(...).update()

@j
Copy link
Author

j commented Dec 28, 2015

I guess my main concern is that the delay isn't just a javascript timer and an actual persisted delay that can live through crashes, etc.

@behrad
Copy link
Collaborator

behrad commented Dec 28, 2015

delay is implemented by a Redis ZSET and a promotion script which is run when a kue process is run, So there's no Javascript timer and delays will survive process restarts :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants