dispatch: Fix intermittent TestMuxPublish issue (#1412)

* Dispatch: Assertify TestMuxPublish

* Dispatch: Fix errDispatcherJobsAtLimit test fails

This test would fail intermittently when the jobs queue drained quickly
enough.
This sets the overload ceiling based on the default settings, and seems
a safe way of ensuring we get an error every time.

It adds a done channel guard around the goro test because otherwise
we'll get a panic occassionally when the goro outlives TestMaxPublish

* Dispatch: Add test for Publish receiving data

* Dispatch: Publish to all subscribers
This commit is contained in:
Gareth Kirwan
2023-12-28 04:54:36 +01:00
committed by GitHub
parent 0a9fdbcdad
commit 9986e80e2d
2 changed files with 42 additions and 49 deletions

View File

@@ -180,11 +180,9 @@ func (d *Dispatcher) relayer() {
continue
}
for i := range pipes {
select {
case pipes[i] <- j.Data:
default:
// no receiver; don't wait. This limits complexity.
}
go func(p chan any) {
p <- j.Data
}(pipes[i])
}
d.rMtx.RUnlock()
case <-d.shutdown: