Implemented the rate limiting from Redis

- Uses Redis cache to check for current count
- If not present then sets the value based on the database state
- Any Redis errors are swallowed. Cache failures should NOT fail  the request.
This commit is contained in:
Martyn Inglis
2016-11-11 16:47:52 +00:00
parent 6c27f8023e
commit 88f04a46cf
8 changed files with 225 additions and 44 deletions

View File

@@ -132,7 +132,7 @@ class Config(object):
STATSD_HOST = "statsd.hostedgraphite.com"
STATSD_PORT = 8125
REDIS_ENABLED = False
REDIS_ENABLED = True
REDIS_URL = "redis://localhost:6379/0"
SENDING_NOTIFICATIONS_TIMEOUT_PERIOD = 259200
@@ -166,6 +166,7 @@ class Development(Config):
class Test(Config):
REDIS_ENABLED = False
NOTIFY_EMAIL_DOMAIN = 'test.notify.com'
FROM_NUMBER = 'testing'
NOTIFY_ENVIRONMENT = 'test'