commit 5e08ad0ae8bd536e9b9f1e578c7416cfb5ecef7a
parent 46abe082db8256cab353f918217fa75a234e4401
Author: n0tr1v <n0tr1v@protonmail.com>
Date: Thu, 28 Dec 2023 22:08:16 -0500
keep track of open streams
Diffstat:
1 file changed, 6 insertions(+), 0 deletions(-)
diff --git a/pkg/web/handlers/api/v1/chat.go b/pkg/web/handlers/api/v1/chat.go
@@ -430,6 +430,12 @@ func ChatStreamMenuHandler(c echo.Context) error {
return c.HTML(http.StatusOK, s)
}
+ // Keep track of users streams, so we can limit how many are open at one time per user
+ if err := usersStreamsManager.Inst.Add(authUser.ID, ""); err != nil {
+ return nil
+ }
+ defer usersStreamsManager.Inst.Remove(authUser.ID, "")
+
quit := hutils.SetStreaming(c)
send := func(s string) { _, _ = c.Response().Write([]byte(s)) }
selfRefreshLoadingIconTopic := "refresh_loading_icon_" + string(authUser.Username)