0
0
Fork 0
mirror of https://github.com/matrix-org/dendrite synced 2024-11-14 13:51:20 +01:00

Don't reset counters before successful outgoing federation request (#1089)

* Don't reset counters before successful outgoing federation request on incoming federation request

* Comments
This commit is contained in:
Neil Alexander 2020-06-04 10:54:10 +01:00 committed by GitHub
parent 8a6152ca70
commit 225b72bd42
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -59,8 +59,11 @@ func (oq *destinationQueue) retry() {
// and then skip ahead a lot which feels non-ideal but equally we can't persist thousands of events
// in-memory to maybe-send it one day. Ideally we would just shove these pending events in a database
// so we can send a lot of events.
oq.statistics.Success()
// if we were backing off, swap to not backing off and interrupt the select.
//
// Interrupt the backoff. If the federation request that happens as a result of this is successful
// then the counters will be reset there and the backoff will cancel. If the federation request
// fails then we will retry at the current backoff interval, so as to prevent us from spamming
// homeservers which are behaving badly.
// We need to use an atomic bool here to prevent multiple calls to retry() blocking on the channel
// as it is unbuffered.
if oq.backingOff.CAS(true, false) {