diff --git a/src/Cron.hs b/src/Cron.hs index 4697c4bf8..1d1abec41 100644 --- a/src/Cron.hs +++ b/src/Cron.hs @@ -116,9 +116,10 @@ genMatch :: Int -- ^ Period genMatch p m z st CronMatchAny = take p $ map (bool id (bool succ id z . (`mod` fromIntegral p) . bool pred id z) m) [st..] genMatch _ _ _ _ CronMatchNone = [] genMatch p m z _ (CronMatchSome xs) = take p . map (bool id (bool succ id z . (`mod` fromIntegral p) . bool pred id z) m) . Set.toAscList $ toNullable xs -genMatch p m z st (CronMatchStep step) = do +genMatch p m z st (CronMatchStep step) = do + guard $ step /= 0 start <- [st..st + step] - guard $ (start `mod` step) == 0 + guard $ (start `mod` step) == 0 take (ceiling $ fromIntegral p % step) $ map (bool id (bool succ id z . (`mod` fromIntegral p) . bool pred id z) m) [start,start + step..] genMatch p m z st (CronMatchContiguous from to) = take p . map (bool id (bool succ id z . (`mod` fromIntegral p) . bool pred id z) m) $ [max st from..to] genMatch _ _ _ _ (CronMatchIntersect CronMatchNone _) = [] diff --git a/src/Jobs/Handler/Files.hs b/src/Jobs/Handler/Files.hs index d304ebd2f..2e5588a81 100644 --- a/src/Jobs/Handler/Files.hs +++ b/src/Jobs/Handler/Files.hs @@ -275,7 +275,7 @@ dispatchJobInjectFiles = JobHandlerException . maybeT_ $ do -> Handler (Sum Natural, Sum Word64) injectOrDelete (objInfo, fRef) = do let obj = Minio.oiObject objInfo - sz = fromIntegral $ Minio.oiSize objInfo + sz = fromIntegral $ max 1 $ Minio.oiSize objInfo fRef' <- runDB $ do logger <- askLoggerIO diff --git a/src/Jobs/HealthReport.hs b/src/Jobs/HealthReport.hs index 54e0317ec..a53dc8616 100644 --- a/src/Jobs/HealthReport.hs +++ b/src/Jobs/HealthReport.hs @@ -119,7 +119,9 @@ dispatchHealthCheckLDAPAdmins = fmap HealthLDAPAdmins . yesodTimeout (^. _appHea let hCampusExc :: CampusUserException -> Handler (Sum Integer) hCampusExc err = mempty <$ $logErrorS "healthCheckLDAPAdmins" (adminIdent <> ": " <> tshow err) in handle hCampusExc $ Sum 1 <$ campusUserReTest ldapPool ((>= reTestAfter) . realToFrac) FailoverUnlimited (Creds apLdap adminIdent []) - return $ numResolved % numAdmins + if numAdmins == 0 + then return 0 + else return $ numResolved % numAdmins _other -> return Nothing