commit f5e9fc53d7f79f89fe75b519c0cd626fdb6e3e6c
parent 77a9d9361b2100bb676528f85400e033826eef98
Author: n0tr1v <n0tr1v@protonmail.com>
Date: Tue, 23 May 2023 08:35:09 -0700
cleanup
Diffstat:
1 file changed, 2 insertions(+), 18 deletions(-)
diff --git a/pkg/web/handlers/handlers.go b/pkg/web/handlers/handlers.go
@@ -4798,16 +4798,8 @@ func ChessGameHandler(c echo.Context) error {
return nil
}
- quit := make(chan bool)
-
// Listen to the closing of HTTP connection via CloseNotifier
notify := c.Request().Context().Done()
- utils.SGo(func() {
- select {
- case <-notify:
- }
- close(quit)
- })
c.Response().Header().Set(echo.HeaderContentType, echo.MIMETextHTMLCharsetUTF8)
c.Response().WriteHeader(http.StatusOK)
@@ -4834,7 +4826,7 @@ func ChessGameHandler(c echo.Context) error {
Loop:
for {
select {
- case <-quit:
+ case <-notify:
break Loop
default:
}
@@ -4899,16 +4891,8 @@ func ChatStreamMessagesHandler(c echo.Context) error {
return c.Redirect(http.StatusFound, "/")
}
- quit := make(chan bool)
-
// Listen to the closing of HTTP connection via CloseNotifier
notify := c.Request().Context().Done()
- utils.SGo(func() {
- select {
- case <-notify:
- }
- close(quit)
- })
c.Response().Header().Set(echo.HeaderContentType, echo.MIMETextHTMLCharsetUTF8)
c.Response().WriteHeader(http.StatusOK)
@@ -4947,7 +4931,7 @@ func ChatStreamMessagesHandler(c echo.Context) error {
Loop:
for {
select {
- case <-quit:
+ case <-notify:
break Loop
default:
}