Skip to content

Instantly share code, notes, and snippets.

@devxpy
Last active November 24, 2018 22:08
Show Gist options
  • Save devxpy/beea2b967913aabdadc144834d0d4722 to your computer and use it in GitHub Desktop.
Save devxpy/beea2b967913aabdadc144834d0d4722 to your computer and use it in GitHub Desktop.
def roundrobin(pending):
remaining = set(pending)
index = 0
while remaining:
for requester in list(remaining):
try:
if process_success(requester, pending[requester][index]):
del pending[requester][index]
except IndexError:
remaining.remove(requester)
else:
index += 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment