fix(notification): add context handling for graceful shutdown in Live function

This commit is contained in:
Jacky
2025-05-05 02:51:19 +00:00
parent fc507ccd3b
commit 918ae3a6b6

View File

@@ -1,12 +1,14 @@
package notification
import (
"io"
"time"
"github.com/0xJacky/Nginx-UI/api"
"github.com/0xJacky/Nginx-UI/internal/kernel"
"github.com/0xJacky/Nginx-UI/internal/notification"
"github.com/0xJacky/Nginx-UI/model"
"github.com/gin-gonic/gin"
"io"
"time"
)
func Live(c *gin.Context) {
@@ -38,6 +40,8 @@ func Live(c *gin.Context) {
case <-notify:
notification.RemoveClient(c)
return
case <-kernel.Context.Done():
return
}
}
}