Dispatch: Fix race during stop (#1443)

* Dispatch: Assertify tests

* Dispatch: Fix race during stop

If we have blocking writers, then we need to synchronise them exiting
before closing off their channels.

* Dispatch: Rename Routes mutex for clarity
This commit is contained in:
Gareth Kirwan
2024-01-22 05:09:57 +01:00
committed by GitHub
parent 0c40f90ceb
commit 45d65c4906
3 changed files with 129 additions and 301 deletions

View File

@@ -29,8 +29,8 @@ type Dispatcher struct {
// then publish the data across the full registered channels for that uuid.
// See relayer() method below.
routes map[uuid.UUID][]chan interface{}
// rMtx protects the routes variable ensuring acceptable read/write access
rMtx sync.RWMutex
// routesMtx protects the routes variable ensuring acceptable read/write access
routesMtx sync.Mutex
// Persistent buffered job queue for relayers
jobs chan job