From fc49f46f506c6d819e89f9b6e0fe2379e4967c20 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Fri, 17 Jul 2020 16:52:34 +0200 Subject: [PATCH] refactor: hlint --- .hlint.yaml | 1 + src/Utils/Failover.hs | 8 ++------ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/.hlint.yaml b/.hlint.yaml index 6a77d647a..f12dfd72c 100644 --- a/.hlint.yaml +++ b/.hlint.yaml @@ -11,6 +11,7 @@ - ignore: { name: "Use ++" } - ignore: { name: "Use ***" } - ignore: { name: "Redundant void" } + - ignore: { name: "Too strict maybe" } - arguments: - -XQuasiQuotes diff --git a/src/Utils/Failover.hs b/src/Utils/Failover.hs index 76e616da9..db666a5d1 100644 --- a/src/Utils/Failover.hs +++ b/src/Utils/Failover.hs @@ -150,9 +150,7 @@ 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' - -> case P.next failover' of - Just failover'' -> failover'' - Nothing -> failover' + -> fromMaybe failover' $ P.next failover' | otherwise -> failover' @@ -212,7 +210,7 @@ failoverMetrics fLbl failoverMetricsFailover@Failover{..} = Metric $ do now <- liftIO $ getTime Monotonic cTime <- liftIO getPOSIXTime - metrics <- atomically $ do + atomically $ do foState <- readTVar failover labelsSeen' <- stateTVar labelsSeen $ \labelsSeen' -> labelsSeen' & ala Endo foldMap [ Map.insert failoverLabel failoverLastTest | FailoverItem{..} <- F.toList foState ] @@ -228,8 +226,6 @@ failoverMetrics fLbl failoverMetricsFailover@Failover{..} = Metric $ do ] ] - return metrics - failoverActiveInfo = Info "uni2work_failover_active_bool" "Currently active item in the failover set" failoverLastTestInfo = Info "uni2work_failover_last_test_time"