This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
)
|
||||
|
||||
// WaitForStop blocks until the context is cancelled or a signal is received.
|
||||
// It accepts a channel so shutdown behavior can be tested without sending a real OS signal.
|
||||
func WaitForStop(ctx context.Context, signals <-chan os.Signal) {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
case <-signals:
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user