Last active
December 13, 2015 17:27
-
-
Save shishirsharma/74a328e5a8491bbdf0b2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Config Part | |
import dnd | |
dnd.configure(host='localhost', port=6379, db=0) | |
# Set Rules | |
dnd.config.rule.add('notification', 'promotion', 60) | |
# Enforce Uses | |
array = [] | |
with dnd.throttle('notification', 10, 'promotion') as pipe: | |
if pipe: array.append(1) | |
with dnd.throttle('notification', 10, 'promotion') as pipe: | |
if pipe: array.append(2) | |
print array | |
# [1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Do Not Disturb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pip install dnd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment