Skip to content

Commit

Permalink
enable throttling in staging
Browse files Browse the repository at this point in the history
  • Loading branch information
gagantrivedi committed Jan 22, 2024
1 parent 01d0f2b commit adc0927
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
2 changes: 2 additions & 0 deletions api/app/settings/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,8 @@
# and set the cache location to the redis url
# ref: https://github.com/jazzband/django-redis/tree/5.4.0#configure-as-cache-backend

# Set this to `core.redis_cluster.ClusterConnectionFactory` if using redis cluster
DJANGO_REDIS_CONNECTION_FACTORY = env.str("DJANGO_REDIS_CONNECTION_FACTORY", "")
# Avoid raising exceptions if redis is down
# ref: https://github.com/jazzband/django-redis/tree/5.4.0#memcached-exceptions-behavior
DJANGO_REDIS_IGNORE_EXCEPTIONS = env.bool(
Expand Down
18 changes: 13 additions & 5 deletions infrastructure/aws/staging/ecs-task-definition-web.json
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,20 @@
"value": "True"
},
{
"name": "ADMIN_THROTTLE_CACHE_BACKEND",
"name": "DEFAULT_THROTTLE_CLASSES",
"value": "core.throttling.UserRateThrottle"
},
{
"name": "DJANGO_REDIS_CONNECTION_FACTORY",
"value": "core.throttling.UserRateThrottle"
},
{
"name": "USER_THROTTLE_CACHE_BACKEND",
"value": "django_redis.cache.RedisCache"
},
{
"name": "USER_THROTTLE_CACHE_LOCATION",
"value": "rediss://serverless-redis-cache-7u3xil.serverless.euw2.cache.amazonaws.com:6379"
}
],
"secrets": [
Expand Down Expand Up @@ -224,10 +236,6 @@
{
"name": "SSE_AUTHENTICATION_TOKEN",
"valueFrom": "arn:aws:secretsmanager:eu-west-2:302456015006:secret:ECS-API-heAdoB:SSE_AUTHENTICATION_TOKEN::"
},
{
"name": "ADMIN_THROTTLE_CACHE_LOCATION",
"valueFrom": "arn:aws:secretsmanager:eu-west-2:302456015006:secret:ECS-API-heAdoB:REDIS_CACHE_URL::"
}
],
"logConfiguration": {
Expand Down

0 comments on commit adc0927

Please sign in to comment.