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

Start Worker Dyno Closer to run_at #80

Open
Sammidysam opened this issue Jun 27, 2014 · 3 comments
Open

Start Worker Dyno Closer to run_at #80

Sammidysam opened this issue Jun 27, 2014 · 3 comments

Comments

@Sammidysam
Copy link

It would be really cool if, instead of starting a worker right when a new job is created and stopping the worker when all jobs are completed, a worker is started a minute before a job, that job is completed, and then the worker is closed if there is not another job in the next minute. This would allow jobs that are to be run very far in the future, e.g. 5 days, to not cause massive payments by the user.

I don't know if this is actually possible, but it would be fantastic if it could be done.

@davidakachaos
Copy link
Collaborator

The problem is that there must some kind of timer be involved. How else can we start a worker?

@lyuzashi
Copy link

I had in mind to write a fork or patch to use an Event Machine timer in a thread which waits until (or close to) run_at before starting the worker process.
This idea may be beyond the scope of Workless or require introducing dependencies which may cause issues.
Once I have the time to write it I could submit a pull request if others are interested. I'd like to hear from @lostboy for any thoughts on this approach.

@paulcc
Copy link

paulcc commented Jan 10, 2018

Please see #106 - there is some middleware which regularly checks to see if scaling changes are needed, and we can use that mechanism to trigger wake-ups. Then you can change the any-jobs query to just look a few minutes into the future. We've used something like this for a few years!

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