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

repair only affects one job #13

Open
robshep opened this issue Jun 4, 2019 · 0 comments
Open

repair only affects one job #13

robshep opened this issue Jun 4, 2019 · 0 comments

Comments

@robshep
Copy link

robshep commented Jun 4, 2019

The use of find_and_modify means only one Job is recovered from stale lock.

The same query + update expressions work with the PyMongo function update_many which updates all documents that match.

it = q.collection.update_many({"locked_by": {"$ne": None}, "locked_at": { "$lt": datetime.now() - timedelta(0.125)}},{"$set": {"locked_by": None, "locked_at": None},"$inc": {"attempts": 1}})
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

1 participant