fix: service group not working well when callback takes long time (#4531)

Signed-off-by: kevin <wanjunfeng@gmail.com>
This commit is contained in:
Kevin Wan
2025-01-01 15:06:50 +08:00
committed by GitHub
parent 5c3679ffe7
commit fcc246933c
5 changed files with 66 additions and 2 deletions

View File

@@ -82,6 +82,9 @@ func (lm *listenerManager) addListener(fn func()) (waitForCalled func()) {
})
lm.lock.Unlock()
// we can return lm.waitGroup.Wait directly,
// but we want to make the returned func more readable.
// creating an extra closure would be negligible in practice.
return func() {
lm.waitGroup.Wait()
}