Skip to content

Instantly share code, notes, and snippets.

@sdornan
Created October 27, 2011 22:31
Show Gist options
  • Save sdornan/1321098 to your computer and use it in GitHub Desktop.
Save sdornan/1321098 to your computer and use it in GitHub Desktop.
while not redis.setnx(self.THROTTLE_KEY, datetime.datetime.now() + datetime.timedelta(seconds=3)):
time.sleep(1)
redis.expire(self.THROTTLE_KEY, 3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment