commit e2d65ab24f5acdbd5fb2c5107d38ced5d0cf9fdb
parent 70c1b20552bc4205eb315e37d7704987d62316eb
Author: n0tr1v <n0tr1v@protonmail.com>
Date: Thu, 28 Dec 2023 21:58:53 -0500
cleanup
Diffstat:
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/pkg/utils/utils.go b/pkg/utils/utils.go
@@ -753,6 +753,10 @@ type Once struct {
done uint32
}
+func (o *Once) Now() <-chan time.Time {
+ return o.After(0)
+}
+
// After if and only if After is being called for the first time for this instance of Once.
func (o *Once) After(duration time.Duration) <-chan time.Time {
if atomic.LoadUint32(&o.done) == 1 {
diff --git a/pkg/web/handlers/api/v1/chat.go b/pkg/web/handlers/api/v1/chat.go
@@ -450,7 +450,7 @@ func ChatStreamMenuHandler(c echo.Context) error {
Loop:
for {
select {
- case <-once.After(0 * time.Millisecond):
+ case <-once.Now():
case <-time.After(5 * time.Second):
case <-sub.ReceiveCh():
send(`<meta http-equiv="refresh" content="1" />`)