Skip to content

Commit 41e1b2b

Browse files
authored
ntf: use common function for differentiating temporary errors (#1333)
1 parent 1afa020 commit 41e1b2b

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/Simplex/Messaging/Agent/NtfSubSupervisor.hs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ runNtfSMPWorker c srv Worker {doWork} = forever $ do
370370
addRes (a, r_) (as, errs, rs) = case r_ of
371371
Right r -> (as, errs, (a, r) : rs)
372372
Left e
373-
| tempErr e -> (a : as, errs, rs)
373+
| temporaryOrHostError e -> (a : as, errs, rs)
374374
| otherwise -> (as, (a, e) : errs, rs)
375375

376376
rescheduleAction :: TMVar () -> UTCTime -> UTCTime -> AM' Bool
@@ -386,16 +386,10 @@ rescheduleAction doWork ts actionTs
386386
retryOnError :: AgentClient -> Text -> AM () -> (AgentErrorType -> AM ()) -> AgentErrorType -> AM ()
387387
retryOnError c name loop done e = do
388388
logError $ name <> " error: " <> tshow e
389-
if tempErr e
389+
if temporaryOrHostError e
390390
then retryNetworkLoop c loop
391391
else done e
392392

393-
tempErr :: AgentErrorType -> Bool
394-
tempErr = \case
395-
BROKER _ NETWORK -> True
396-
BROKER _ TIMEOUT -> True
397-
_ -> False
398-
399393
retryNetworkLoop :: AgentClient -> AM () -> AM ()
400394
retryNetworkLoop c loop = do
401395
atomically $ endAgentOperation c AONtfNetwork

0 commit comments

Comments
 (0)