You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We want to rate limit our cloud function(s) to hedge operation cost and avoid DOS attacks. For this ticket, we'll experiment this with /fetchFriendSchedules.
Acceptance Criteria
/fetchFriendSchedules is rate limited.
Throttled requests return an error and that error is displayed on the UI.
Other Note
There are many rate-limiting strategies but we want to use one that can handle fluctuating traffic (so leaky bucket might not be the best choice)
We can throttle requests based on some operation identifier (e.g., throttle per endpoint, per IP address, per user, etc.). Take that into consideration when designing this rate limiter.
The text was updated successfully, but these errors were encountered:
### Summary
Resolves#207
Sibling PR: gt-scheduler/firebase-conf#4
We want to be able to rate limit the `/fetchFriendSchedules` firebase
cloud function endpoint to prevent DOS attacks and increased server
costs. I implemented a client-side Leaky Bucket solution using a request
count stored in the local storage. The counts are updated based on the
last request time when a new request is made. The rate limiter does not
restrict the background calls to the endpoint that syncs any change to
friend schedules. Each second, the request count increases by 1 and is
capped at 10.
Note: This rate limiter does not sync request count across devices due
to the usage of local storage. To do so, we might have to use an extra
collection which might increase costs.
### Checklist
- [x] /fetchFriendSchedules is rate limited.
- [x] Throttled requests return an error and that error is displayed on
the UI.
### How to Test
- Change the rate limiter capacity and interval in
`src\data\hooks\useRawFriendScheduleDataFromFirebaseFunction.ts` to
something that can be reached by normal page reloads
---------
Co-authored-by: nathangong <[email protected]>
Co-authored-by: Nghi Ho <[email protected]>
Co-authored-by: Hailey Ho <[email protected]>
Description
We want to rate limit our cloud function(s) to hedge operation cost and avoid DOS attacks. For this ticket, we'll experiment this with
/fetchFriendSchedules
.Acceptance Criteria
/fetchFriendSchedules
is rate limited.Other Note
The text was updated successfully, but these errors were encountered: