Unbuffered channel to block /send causing sytest to not race anymore

This commit is contained in:
Kegan Dougal 2020-08-07 12:47:16 +01:00
parent 99885a4d7e
commit 44a41836f0

View file

@ -110,10 +110,13 @@ func NewDeviceListUpdater(
// Start the device list updater, which will try to refresh any stale device lists.
func (u *DeviceListUpdater) Start() error {
for i := 0; i < len(u.workerChans); i++ {
// Allocate a small buffer per channel.
// Allocate no buffer per channel.
// If the buffer limit is reached, backpressure will cause the processing of EDUs
// to stop (in this transaction) until key requests can be made.
ch := make(chan gomatrixserverlib.ServerName, 10)
// This is important for sytest as when the /send transaction 200 OKs it assumes that
// keys have been fetched and will then issue requests to /keys/query which it expects
// to be satisfied from the cache (which it won't be if we haven't processed it yet).
ch := make(chan gomatrixserverlib.ServerName, 0)
u.workerChans[i] = ch
go u.worker(ch)
}