mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2026-05-06 22:12:23 +08:00
fix(notification): add context handling for graceful shutdown in Live function
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user