commit c6230f937bd3a695205bc40af32b091193978884
parent 6168b6f948bc55ecd6bded17afa41d9a4dd73125
Author: n0tr1v <n0tr1v@protonmail.com>
Date: Wed, 24 May 2023 07:31:14 -0700
simplify code
Diffstat:
1 file changed, 1 insertion(+), 10 deletions(-)
diff --git a/pkg/web/handlers/handlers.go b/pkg/web/handlers/handlers.go
@@ -4930,27 +4930,18 @@ var usersStreamsManager = NewUsersStreamsManager()
func closeSignalChan(c echo.Context) <-chan struct{} {
ctx, cancel := context.WithCancel(context.Background())
-
// Listen to the closing of HTTP connection via CloseNotifier
notify := c.Request().Context().Done()
- utils.SGo(func() {
- select {
- case <-notify:
- case <-ctx.Done():
- }
- cancel()
- })
-
notify1 := make(chan os.Signal)
signal.Notify(notify1, syscall.SIGINT, syscall.SIGTERM)
utils.SGo(func() {
select {
+ case <-notify:
case <-notify1:
case <-ctx.Done():
}
cancel()
})
-
return ctx.Done()
}