Fixes stuck Go-routine
Fixes https://github.com/pterodactyl/panel/issues/1816 Credit goes to https://github.com/matthewpi
This commit is contained in:
parent
b37a4a4926
commit
5bde25d5b5
|
@ -187,17 +187,13 @@ func (rt *Router) routeWebsocket(w http.ResponseWriter, r *http.Request, ps http
|
||||||
|
|
||||||
// Listen for different events emitted by the server and respond to them appropriately.
|
// Listen for different events emitted by the server and respond to them appropriately.
|
||||||
go func() {
|
go func() {
|
||||||
for {
|
for d := range eventChannel {
|
||||||
select {
|
|
||||||
case d := <-eventChannel:
|
|
||||||
handler.SendJson(&WebsocketMessage{
|
handler.SendJson(&WebsocketMessage{
|
||||||
Event: d.Topic,
|
Event: d.Topic,
|
||||||
Args: []string{d.Data},
|
Args: []string{d.Data},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}()
|
}()
|
||||||
|
|
||||||
// Sit here and check the time to expiration on the JWT every 30 seconds until
|
// Sit here and check the time to expiration on the JWT every 30 seconds until
|
||||||
// the token has expired. If we are within 3 minutes of the token expiring, send
|
// the token has expired. If we are within 3 minutes of the token expiring, send
|
||||||
// a notice over the socket that it is expiring soon. If it has expired, send that
|
// a notice over the socket that it is expiring soon. If it has expired, send that
|
||||||
|
|
Loading…
Reference in New Issue
Block a user