Skip to content

[hotfix] Add batch size and interval to broadcast messages

feed back requested to merge rate-limit-test into master

Context:

Changes

  • this batches messages to send in bursts of 50 every minute to avoid rate limiting

Out of Scope

  • we might want to provide users with a footer notifying them that their message was sent earlier than they are receiving it but that is left to a separate card. (if we do it at all!)

Technical Details

Leaky Bucket Rate Limiting

  • Signal uses the leaky bucket rate limiting algorithm
  • It works by having two things: a bucket size and a leak rate
  • Every request that comes in is added to the bucket
  • Every x amount of time (for signal it is per minute), the bucket will leak out certain # of requests (the leak rate)
  • Success example: attachments for signal have a bucket size of 50 and a leak rate of 50/minute. if we send 35 requests at a time, the bucket will go up to 35 and then after a minute, they will leak out, which means that all requests we sent were valid
  • Failure example: if we send 60 requests in a minute, the bucket will go up to 50 as that is the bucket size, those 50 requests will be processed and then the remaining 10 will all be dropped. after 1 minute, the bucket will go back down to 0

image

Edited by feed back

Merge request reports