oncall-engine/engine/apps/integrations/throttlers/integration_backsync_throttler.py
Yulya Artyukhina ed60b67884
Integtation backsync endpoint (#4082)
# What this PR does
Adds endpoint for integration backsync
Related to https://github.com/grafana/oncall-private/issues/2542

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.
2024-03-20 11:26:33 +00:00

14 lines
374 B
Python

from rest_framework.throttling import SimpleRateThrottle
class BacksyncRateThrottle(SimpleRateThrottle):
"""
Integration backsync rate limit
"""
scope = "backsync"
rate = "300/m"
def get_cache_key(self, request, view):
ident = request.auth.alert_receive_channel.pk
return self.cache_format % {"scope": self.scope, "ident": ident}