logs: fix time unit of output

This commit is contained in:
1computer1 2020-06-22 03:10:24 -04:00
parent c952aa448c
commit 1c2ad37d60

View file

@ -69,15 +69,17 @@ startCleanup :: Myriad ()
startCleanup = do startCleanup = do
config <- gview #config config <- gview #config
when (config ^. #cleanupInterval > 0) . void $ do when (config ^. #cleanupInterval > 0) . void $ do
let t = fromIntegral (config ^. #cleanupInterval) * 60000000 let t = fromIntegral (config ^. #cleanupInterval)
fork $ timer t fork $ timer t
where where
-- Given time in minutes
timer :: Int -> Myriad () timer :: Int -> Myriad ()
timer t = forever $ do timer t = forever $ do
threadDelay t -- Takes time in microseconds
threadDelay $ t * 60000000
logInfo ["Starting cleanup of containers"] logInfo ["Starting cleanup of containers"]
n <- killContainers n <- killContainers
logInfo ["Cleaned up ", cs $ show n, " containers, next in ", cs $ show t, " seconds"] logInfo ["Cleaned up ", cs $ show n, " containers, next in ", cs $ show t, " minutes"]
timer t timer t
setupContainer :: Language -> Myriad ContainerName setupContainer :: Language -> Myriad ContainerName
@ -202,8 +204,11 @@ evalCode lang numRetries code = withContainer $ \cnt -> do
timer :: ContainerName -> MVar Bool -> Myriad () timer :: ContainerName -> MVar Bool -> Myriad ()
timer cnt doneRef = do timer cnt doneRef = do
logDebug ["Starting timeout of ", cs . show $ lang ^. #timeout, " seconds for container ", cs cnt] -- Given time in seconds
threadDelay $ fromIntegral (lang ^. #timeout) * 1000000 let t = fromIntegral $ lang ^. #timeout
logDebug ["Starting timeout of ", cs . show $ t, " seconds for container ", cs cnt]
-- Takes time in microseconds
threadDelay $ t * 1000000
done <- readMVar doneRef done <- readMVar doneRef
if done if done
then do then do