add context timeouts to avoid hanging wings boot process if docker has a hiccup; closes pterodactyl/panel#3358
This commit is contained in:
@@ -101,7 +101,7 @@ func postServerPower(c *gin.Context) {
|
||||
func postServerCommands(c *gin.Context) {
|
||||
s := ExtractServer(c)
|
||||
|
||||
if running, err := s.Environment.IsRunning(); err != nil {
|
||||
if running, err := s.Environment.IsRunning(c.Request.Context()); err != nil {
|
||||
NewServerError(err, s).Abort(c)
|
||||
return
|
||||
} else if !running {
|
||||
|
||||
@@ -368,7 +368,9 @@ func (h *Handler) HandleInbound(m Message) error {
|
||||
}
|
||||
case SendServerLogsEvent:
|
||||
{
|
||||
if running, _ := h.server.Environment.IsRunning(); !running {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), time.Second * 5)
|
||||
defer cancel()
|
||||
if running, _ := h.server.Environment.IsRunning(ctx); !running {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user