Unregister stateless agents from server on termination (#2606)

Closes #2027

---------

Co-authored-by: 6543 <6543@obermui.de>
This commit is contained in:
Thomas Anderson
2023-11-02 02:53:47 +03:00
committed by GitHub
parent ec62a1d0c6
commit 3620c84da4
14 changed files with 157 additions and 61 deletions

View File

@@ -34,10 +34,10 @@ func WithContextSigtermCallback(ctx context.Context, f func()) context.Context {
select {
case <-ctx.Done():
case <-receivedSignal:
cancel(fmt.Errorf("received signal: %v", receivedSignal))
if f != nil {
f()
}
cancel(fmt.Errorf("received signal: %v", receivedSignal))
}
}()