Skip to content

Commit

Permalink
benoitc#3227: Use a monotonic clock to measure elapsed time.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michal Daniliszyn 1 committed Jul 12, 2024
1 parent 34ce875 commit bcdbc09
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions gunicorn/workers/ggevent.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ def _wait_for_keepalive(self, servers):
# if any of those greenlets are still active. If none are active, exit the loop.

greenlets = {id(greenlet) for server in servers for greenlet in server.pool.greenlets}
ts = time.time()
ts = time.monotonic()

while time.time() - ts <= self.cfg.keepalive:
while time.monotonic() - ts <= self.cfg.keepalive:
if not greenlets.intersection({id(greenlet) for server in servers for greenlet in server.pool.greenlets}):
break
self.notify()
Expand Down

0 comments on commit bcdbc09

Please sign in to comment.