Skip to content
This repository was archived by the owner on Sep 20, 2022. It is now read-only.

Find a better way to purge stale pools and re-queue stale jobs #6

Open
albrow opened this issue Apr 15, 2015 · 2 comments
Open

Find a better way to purge stale pools and re-queue stale jobs #6

albrow opened this issue Apr 15, 2015 · 2 comments

Comments

@albrow
Copy link
Owner

albrow commented Apr 15, 2015

Currently, there is a process during initialization in which a pool pings all the other pools to determine if any of them have gone down. If they have, any jobs that belong to that pool that were still executing are considered stale and a re-queued. This will prevent jobs from staying stale as long as any time a worker pool machine goes down, either it is rebooted or another machine takes its place.

It would be better if this process occurred periodically instead of just on initialization. The frequency of the pings should be configurable.

@albrow
Copy link
Owner Author

albrow commented Apr 17, 2015

On second thought, having each worker pool periodically ping every other worker pool might be okay for a small number of pools. But if the number of pools gets really large it could become impractical. Going to research other ideas. Would appreciate hearing any suggestions!

@albrow albrow changed the title Periodically ping pools to find stale jobs Find a better way to purge stale pools and re-queue stale jobs Apr 17, 2015
@utrack
Copy link
Contributor

utrack commented Aug 18, 2015

Maybe create a zset workerid-time and make every pool refresh its entry every 10 seconds or so?

If any pool haven't managed to refresh its entry in, say, 20 sec, it would be considered down, its jobs requeued and its entry removed from the zset. If two pools found out about some other pool that just gone down they'll just exhaust the third pool's job queue without any side effects, thanks to Redis.

However, each pool should also check if its entry wasn't removed from the DB - if we want to guarantee that one job is executed once, that is.

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

No branches or pull requests

2 participants