Skip to content

Commit

Permalink
Be kind, rewind
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberw committed Dec 6, 2023
1 parent 5beeca6 commit 24fd8c3
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions locust_plugins/mongoreader.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,7 @@ def __next__(self):
return doc
except StopIteration:
with dblock:
# there is a tiny chance the last find_one_and_update has not yet completed
# so give it a little extra time so we dont accidentally get data that was just used
if "w=0" in self.uri:
time.sleep(0.5)
self.cursor = self.coll.find(self.query, sort=self.sort)
self.cursor.rewind()
return next(self.cursor)


Expand Down

0 comments on commit 24fd8c3

Please sign in to comment.