fix(print): apc ident aliases did not stop at first success

This commit is contained in:
Steffen Jost 2023-10-04 08:18:46 +00:00
parent 60644528fc
commit b7d4f6913d
2 changed files with 2 additions and 4 deletions

View File

@ -47,7 +47,7 @@ dispatchJobPrintAck = JobHandlerException act
return True
_ -> return False
procOneId oks Entity{entityKey=paid, entityVal=PrintAcknowledge{printAcknowledgeApcIdent=Text.strip -> apci, printAcknowledgeTimestamp=ackt}} =
andM [ackOneId ackt $ ftrans apci | ftrans <- ftransAliases] >>= \case
orM [ackOneId ackt $ ftrans apci | ftrans <- ftransAliases] >>= \case
True -> delete paid >> return (succ oks)
False -> update paid [PrintAcknowledgeProcessed =. True] >> return oks
apcis <- selectList [PrintAcknowledgeProcessed ==. False] [Asc PrintAcknowledgeTimestamp, LimitTo jobPrintAckChunkSize]

View File

@ -1161,9 +1161,7 @@ guardMOnM b x = guardM b *> x
-- Some Utility Functions from Agda.Utils.Monad
-- | Monadic if-then-else.
ifM :: Monad m => m Bool -> m a -> m a -> m a
ifM c m m' =
do b <- c
if b then m else m'
ifM c x y = c >>= bool y x
-- | @ifNotM mc = ifM (not <$> mc)@ from Agda.Utils.Monad
ifNotM :: Monad m => m Bool -> m a -> m a -> m a