Skip to content

Instantly share code, notes, and snippets.

@mreiferson
Last active December 17, 2015 04:09
Show Gist options
  • Save mreiferson/5548391 to your computer and use it in GitHub Desktop.
Save mreiferson/5548391 to your computer and use it in GitHub Desktop.
is_starved
def is_starved(conns):
for c in conns:
# the constant 0.85 is designed to *anticipate* starvation rather than wait for it
if c.in_flight > 0 and c.in_flight >= (c.last_ready * 0.85):
return True
return False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment