aboutsummaryrefslogtreecommitdiff
path: root/src/server/Job.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/Job.hs')
-rw-r--r--src/server/Job.hs25
1 files changed, 0 insertions, 25 deletions
diff --git a/src/server/Job.hs b/src/server/Job.hs
deleted file mode 100644
index bf8f15b..0000000
--- a/src/server/Job.hs
+++ /dev/null
@@ -1,25 +0,0 @@
-module Job
- ( jobListener
- ) where
-
-import Data.Time.Clock
-
-import Control.Concurrent (threadDelay)
-
-import Model.Database
-import Model.JobKind
-import Model.Job
-
-jobListener :: JobKind -> (UTCTime -> IO Bool) -> (() -> Persist ()) -> Int -> IO ()
-jobListener kind lastExecutionTooOld runJob msDelay = do
- mbLastExecution <- runDb $ do
- actualizeLastCheck kind
- getLastExecution kind
- hasToRun <- case mbLastExecution of
- Just lastExecution -> lastExecutionTooOld lastExecution
- Nothing -> return True
- if hasToRun
- then runDb (runJob () >> actualizeLastExecution kind)
- else return ()
- threadDelay msDelay
- jobListener kind lastExecutionTooOld runJob msDelay