albrow / jobs

A persistent and flexible background jobs library for go.
MIT License
499 stars 47 forks source link

Use a unique machine identifier for generating pool ids #5

Closed albrow closed 9 years ago

albrow commented 9 years ago

Currently, a rebooted machine would get a new pool id. If it was in the middle of executing any jobs when it rebooted, those jobs would be stale. In order to detect that the new pool will attempt to ping the old pool, then when it doesn't get a response it would re-queue the stale jobs. This is a little more work than what is necessary.

If the same machine always gets the same pool id, it would allow for a machine to quickly clean up after itself in the event that it is rebooted. On initialization, it could check for any jobs in the executing state with it's own pool id. We wouldn't need to try to ping the old pool to determine that those jobs are stale.

albrow commented 9 years ago

This is now fixed in the develop branch (see 416b0f213f3d6b7b9a7a95329a978fcfa2984882) and will be merged into master for the next release.