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

How to add an execution delay to a task? #7

Open
edhowler opened this issue Apr 29, 2021 · 5 comments
Open

How to add an execution delay to a task? #7

edhowler opened this issue Apr 29, 2021 · 5 comments

Comments

@edhowler
Copy link

edhowler commented Apr 29, 2021

Hi, thanks for this library!

How can I add a task that is executed 10 seconds after it was sent? Is there a simple workaround, in the case it is not implemented?

@edhowler
Copy link
Author

I think I got it, that's a queue configuration, directly in AWS console. I wish I could set it individually for each task.

@melvyn-apryl
Copy link
Contributor

At the risk of missing the point, why don't you add sleep(10) to the task?

@edhowler
Copy link
Author

edhowler commented Jun 9, 2021

Hey, thanks for the idea. That would work, but with the drawback that the worker would be busy for more time than needed.

@DataGreed
Copy link
Owner

DataGreed commented Jun 14, 2021

@edhowler hi! Sorry for such a delay in response. Glad you've found the lib useful.

I've never implemented this time of behavior myself, so I may be not the best person to advise. Anyway, AWS seems to have a feature called delay-queues – I think you can use it to delay visibility of the tasks for the worker. I guess you can create a delay queue and send messages to this queue to delay them.

@romatallinn
Copy link

romatallinn commented Apr 18, 2022

This feature is something that could be very useful. The aforementioned delay-queues only allow to configure the delay for the whole queue, but a very standard task is to delay certain tasks by different durations. For example, send a letter to the user after 10 minutes of his registration. Or send a push notification reminder in an hour. Sleep surely won't work in this scenario. Having a cron job every minute to match some conditions in DB is also a huge overhead.

P.S. If anybody found a suitable alternative, please let me know.

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

No branches or pull requests

4 participants