Don't log disk space errors
This commit is contained in:
parent
60211271b2
commit
ae5005baa3
|
@ -174,7 +174,9 @@ func (h *Handler) TokenValid() error {
|
||||||
// error message, otherwise we just send back a standard error message.
|
// error message, otherwise we just send back a standard error message.
|
||||||
func (h *Handler) SendErrorJson(msg Message, err error, shouldLog ...bool) error {
|
func (h *Handler) SendErrorJson(msg Message, err error, shouldLog ...bool) error {
|
||||||
j := h.GetJwt()
|
j := h.GetJwt()
|
||||||
expected := errors.Is(err, server.ErrSuspended) || errors.Is(err, server.ErrIsRunning)
|
expected := errors.Is(err, server.ErrSuspended) ||
|
||||||
|
errors.Is(err, server.ErrIsRunning) ||
|
||||||
|
errors.Is(err, server.ErrNotEnoughDiskSpace)
|
||||||
|
|
||||||
message := "an unexpected error was encountered while handling this request"
|
message := "an unexpected error was encountered while handling this request"
|
||||||
if expected || (j != nil && j.HasPermission(PermissionReceiveErrors)) {
|
if expected || (j != nil && j.HasPermission(PermissionReceiveErrors)) {
|
||||||
|
|
|
@ -38,6 +38,21 @@ func (pa PowerAction) IsStart() bool {
|
||||||
return pa == PowerActionStart || pa == PowerActionRestart
|
return pa == PowerActionStart || pa == PowerActionRestart
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if there is currently a power action being processed for the server.
|
||||||
|
func (s *Server) ExecutingPowerAction() bool {
|
||||||
|
if s.powerLock == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
ok := s.powerLock.TryAcquire(1)
|
||||||
|
if ok {
|
||||||
|
s.powerLock.Release(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remember, if we acquired a lock it means nothing was running.
|
||||||
|
return !ok
|
||||||
|
}
|
||||||
|
|
||||||
// Helper function that can receive a power action and then process the actions that need
|
// Helper function that can receive a power action and then process the actions that need
|
||||||
// to occur for it. This guards against someone calling Start() twice at the same time, or
|
// to occur for it. This guards against someone calling Start() twice at the same time, or
|
||||||
// trying to restart while another restart process is currently running.
|
// trying to restart while another restart process is currently running.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user