lib/model: Refactor folderRunners to use a serviceMap (#9071)
Instead of separately tracking the token.
Also changes serviceMap to have a channel version of RemoveAndWait, so
that it's possible to do the removal under a lock but wait outside of
the lock. And changed where we do that in connection close, reversing
the change that happened when I added the serviceMap in 40b3b9ad1.
This commit is contained in:
@@ -105,10 +105,11 @@ func TestServiceMap(t *testing.T) {
|
||||
|
||||
// Remove two of them from within the iterator.
|
||||
|
||||
sm.Each(func(k string, v *dummyService) {
|
||||
sm.Each(func(k string, v *dummyService) error {
|
||||
if strings.HasPrefix(k, "remove") {
|
||||
sm.RemoveAndWait(k, 0)
|
||||
}
|
||||
return nil
|
||||
})
|
||||
|
||||
// They should have stopped.
|
||||
|
||||
Reference in New Issue
Block a user