denishpatel / pygmy

Pygmy: Saving AWS Bills on Standby DB Servers
5 stars 1 forks source link

The same rule might be run multiple times #57

Closed benchub closed 3 years ago

benchub commented 3 years ago

We should keep track in the db (a persistent durable place to keep state) if a rule is currently in flight and for how long it has been. This should be safer than file locks to protect against concurrent executions of the same job, and by keep track of when the job started, we can use heuristics to say something like "this rule was started >12 hours ago, using this pid... we probably don't need to wait for it anymore, so let's kill that pid if it's still around and move on"

benchub commented 3 years ago

This should be fixed with https://github.com/benchub/pygmy/commit/11192065e7a7a85a214d6f2eb0546139699c5a19