Skip to content

Instantly share code, notes, and snippets.

@arpitbbhayani
Created April 4, 2020 19:40
Show Gist options
  • Save arpitbbhayani/430ab2725851ad1d2fa68b111b715846 to your computer and use it in GitHub Desktop.
Save arpitbbhayani/430ab2725851ad1d2fa68b111b715846 to your computer and use it in GitHub Desktop.
def get_current_window(key, start_time):
ts_data = requests_store.get(key)
if not key:
return 0
total_requests = 0
for ts, count in ts_data.items():
if ts > start_time:
total_requests += count
else:
del ts_data[ts]
return total_requests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment