Skip to content

Instantly share code, notes, and snippets.

@mreiferson
Last active Dec 17, 2015
Embed
What would you like to do?
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