mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-10 18:05:48 +02:00
fix(notification): add context handling for graceful shutdown in Live function
This commit is contained in:
parent
fc507ccd3b
commit
918ae3a6b6
1 changed files with 6 additions and 2 deletions
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue