diff options
author | devonh <devon.dmytro@gmail.com> | 2022-10-19 10:03:16 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-19 11:03:16 +0100 |
commit | 241d5c47dfa9e5cfadc350f688aab30f9e539fbb (patch) | |
tree | c20483f5cb8a97fb61f56188240cb00a1e202fdc /federationapi/storage/shared/storage.go | |
parent | 3aa92efaa3e814ad0596fc5fc174a2e43124dcf5 (diff) |
Refactor Federation Destination Queues (#2807)
This is a refactor of the federation destination queues.
It fixes a few things, namely:
- actually retry outgoing events with backoff behaviour
- obtain enough events from the database to fill messages as much as
possible
- minimize the amount of running goroutines
- use pure timers for backoff
- don't restart queue unless necessary
- close the background task when backing off
- increase max edus in a transaction to match the spec
- cleanup timers more aggresively to reduce memory usage
- add jitter to backoff timers to reduce resource spikes
- add a bunch of tests (with real and fake databases) to ensure
everything is working
Diffstat (limited to 'federationapi/storage/shared/storage.go')
-rw-r--r-- | federationapi/storage/shared/storage.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/federationapi/storage/shared/storage.go b/federationapi/storage/shared/storage.go index 9e40f311..6afb313a 100644 --- a/federationapi/storage/shared/storage.go +++ b/federationapi/storage/shared/storage.go @@ -52,6 +52,10 @@ type Receipt struct { nid int64 } +func NewReceipt(nid int64) Receipt { + return Receipt{nid: nid} +} + func (r *Receipt) String() string { return fmt.Sprintf("%d", r.nid) } |