mongoqueue icon indicating copy to clipboard operation
mongoqueue copied to clipboard

repair only affects one job

Open robshep opened this issue 5 years ago • 0 comments

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}})

robshep avatar Jun 04 '19 17:06 robshep