diff --git a/src/Utils/Failover.hs b/src/Utils/Failover.hs index 6eed49d4b..3e745b5ed 100644 --- a/src/Utils/Failover.hs +++ b/src/Utils/Failover.hs @@ -161,9 +161,12 @@ withFailover' testTarget' f@Failover{..} mode detAcceptable act = withFailoverRe $logErrorS "withFailover'" $ tshow (hashUnique alreadyTested) <> " recording failure for item " <> failoverLabel atomically . modifyTVar failover $ \failover' -> if | views (P.focus . _failoverReferences) (Set.member currentlyTesting) failover' - -> fromMaybe failover' $ P.next failover' + -> fromMaybe (goFirst failover') $ P.next failover' | otherwise -> failover' + where goFirst l = case P.previous l of + Nothing -> l + Just l' -> goFirst l' $logDebugS "withFailover'" $ tshow (hashUnique alreadyTested) <> " using item " <> failoverLabel res' <- handleAll (\err -> $logErrorS "withFailover'" (tshow (hashUnique alreadyTested) <> " exception during act or detAcceptable: " <> tshow err) >> recordFailure >> throwM err) $