From 61066e38964b5eb7f3a085180951f911013fc988 Mon Sep 17 00:00:00 2001 From: "Quentin McGaw (desktop)" Date: Mon, 9 Aug 2021 14:38:15 +0000 Subject: [PATCH] Fix restart mutex unlocking for loops --- internal/loopstate/apply.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/loopstate/apply.go b/internal/loopstate/apply.go index c0f10192..540226dc 100644 --- a/internal/loopstate/apply.go +++ b/internal/loopstate/apply.go @@ -37,6 +37,7 @@ func (s *State) ApplyStatus(ctx context.Context, status models.LoopStatus) ( switch existingStatus { case constants.Stopped, constants.Completed: default: + s.statusMu.Unlock() return "already " + existingStatus.String(), nil } @@ -55,6 +56,7 @@ func (s *State) ApplyStatus(ctx context.Context, status models.LoopStatus) ( return newStatus.String(), nil case constants.Stopped: if existingStatus != constants.Running { + s.statusMu.Unlock() return "already " + existingStatus.String(), nil } @@ -73,6 +75,7 @@ func (s *State) ApplyStatus(ctx context.Context, status models.LoopStatus) ( return newStatus.String(), nil default: + s.statusMu.Unlock() return "", fmt.Errorf("%w: %s: it can only be one of: %s, %s", ErrInvalidStatus, status, constants.Running, constants.Stopped) }