fix(job): jobworkers not working due to dev-settings

This commit is contained in:
Steffen Jost 2025-03-11 16:21:13 +01:00
parent b4f85f155a
commit 3dc74de68e
5 changed files with 25 additions and 20 deletions

View File

@ -8,7 +8,7 @@
# See https://github.com/yesodweb/yesod/wiki/Configuration#parsing-numeric-values-as-strings # See https://github.com/yesodweb/yesod/wiki/Configuration#parsing-numeric-values-as-strings
#DEVELOPMENT ONLY, NOT TO BE USED IN PRODUCTION # DEVELOPMENT ONLY, NOT TO BE USED IN PRODUCTION
avs-licence-synch: avs-licence-synch:
times: [12] times: [12]
@ -17,14 +17,16 @@ avs-licence-synch:
max-changes: 999 max-changes: 999
mail-reroute-to: mail-reroute-to:
name: FRADrive-QA-Umleitungen name: "FRADrive-QA-Umleitungen"
email: FRADrive-TEST-Umleitungen@fraport.de email: "FRADrive-TEST-Umleitungen@fraport.de"
# Enqueue at specified hour, a few minutes later # Enqueue at specified hour, a few minutes later
job-lms-qualifications-enqueue-hour: 16 job-lms-qualifications-enqueue-hour: 16
job-lms-qualifications-dequeue-hour: 4 job-lms-qualifications-dequeue-hour: 4
job-mode: # Using these setting kills the job-workers somehow
tag: offload # job-workers: 5
job-workers: 1 # job-flush-interval: 600
job-flush-interval: 600 # job-stale-threshold: 3600
# job-move-threshold: 60

View File

@ -43,9 +43,6 @@ import qualified Data.Set as Set (notMember)
import qualified Database.Esqueleto.Legacy as E import qualified Database.Esqueleto.Legacy as E
import qualified Database.Esqueleto.Utils as E import qualified Database.Esqueleto.Utils as E
import Control.Monad.Random.Class (uniform)
import Control.Monad.Trans.Random (evalRandTIO)
getLmsCsvDecoder :: (MonadHandler m, HandlerSite m ~ UniWorX, MonadThrow m, FromNamedRecord csv, FromRecord csv) => Handler (ConduitT ByteString csv m ()) getLmsCsvDecoder :: (MonadHandler m, HandlerSite m ~ UniWorX, MonadThrow m, FromNamedRecord csv, FromRecord csv) => Handler (ConduitT ByteString csv m ())
getLmsCsvDecoder = do getLmsCsvDecoder = do
@ -182,12 +179,6 @@ lengthPassword = 8
maxLmsUserIdentRetries :: Int maxLmsUserIdentRetries :: Int
maxLmsUserIdentRetries = 27 maxLmsUserIdentRetries = 27
-- | Generate Random Text of specified length using numbers and lower case letters plus supplied extra characters
randomText :: MonadIO m => String -> Int -> m Text
randomText extra n = fmap pack . evalRandTIO . replicateM n $ uniform range
where
num_letters = ['2'..'9'] ++ ['a'..'h'] ++ 'k' : ['m'..'z'] -- users have trouble distinguishing 1/l and 0/O so we eliminate these; apc has trouble distinguishing i/j and read "ji", "jf" as ligatures "ij", "fj" so we eliminate j as well
range = extra ++ num_letters
--TODO: consider using package elocrypt for user-friendly passwords here, licence requires mentioning of author, etc. though --TODO: consider using package elocrypt for user-friendly passwords here, licence requires mentioning of author, etc. though
-- import qualified Data.Elocrypt as Elo -- import qualified Data.Elocrypt as Elo

View File

@ -70,6 +70,7 @@ dispatchJobSleep :: Int -> JobHandler UniWorX
dispatchJobSleep sleepTime = JobHandlerAtomic act dispatchJobSleep sleepTime = JobHandlerAtomic act
where where
act = do act = do
$logInfoS "JOBS" [st|Sleep job #{sleepTime}s started.|] tag <- randomText "01ijk" 4
$logInfoS "JOBS" [st|Sleep job #{tag} for #{sleepTime}s started.|]
threadDelay (sleepTime * 1000000) threadDelay (sleepTime * 1000000)
$logInfoS "JOBS" [st|Sleep job #{sleepTime}s ended.|] $logInfoS "JOBS" [st|Sleep job #{tag} for #{sleepTime}s ended.|]

View File

@ -863,10 +863,12 @@ widgetFile
-- | Raw bytes at compile time of @config/settings.yml@ (and also @config/develop-setting.yml for development builds) -- | Raw bytes at compile time of @config/settings.yml@ (and also @config/develop-setting.yml for development builds)
configSettingsYmlBS :: ByteString configSettingsYmlBS :: ByteString
configSettingsYmlBS = $(embedFile configSettingsYml) configSettingsYmlBS =
#ifdef DEVELOPMENT #ifdef DEVELOPMENT
<> $(embedFile "config/develop-settings.yml") $(embedFile "config/develop-settings.yml") <>
#endif #endif
$(embedFile configSettingsYml)
-- | @config/settings.yml@, parsed to a @Value@. -- | @config/settings.yml@, parsed to a @Value@.
configSettingsYmlValue :: Value configSettingsYmlValue :: Value

View File

@ -130,6 +130,7 @@ import Data.Constraint (Dict(..))
import Control.Monad.Random.Class (MonadSplit(getSplit), MonadRandom, MonadInterleave(interleave), uniform) import Control.Monad.Random.Class (MonadSplit(getSplit), MonadRandom, MonadInterleave(interleave), uniform)
import Control.Monad.Random (RandomGen) import Control.Monad.Random (RandomGen)
import Control.Monad.Trans.Random (evalRandTIO)
import qualified System.Random.Shuffle as Rand (shuffleM) import qualified System.Random.Shuffle as Rand (shuffleM)
import qualified Control.Monad.Random.Lazy as LazyRand import qualified Control.Monad.Random.Lazy as LazyRand
@ -2040,6 +2041,14 @@ randUUIDC cont = do
return . fromMaybe (error $ "Could not convert bytestring to uuid: " <> show uuidBS) . UUID.fromByteString $ fromStrict uuidBS return . fromMaybe (error $ "Could not convert bytestring to uuid: " <> show uuidBS) . UUID.fromByteString $ fromStrict uuidBS
evalStateC drg $ cont mkUUID lift evalStateC drg $ cont mkUUID lift
-- | Generate Random Text of specified length using numbers and lower case letters plus supplied extra characters
randomText :: MonadIO m => String -> Int -> m Text
randomText extra n = fmap pack . evalRandTIO . replicateM n $ uniform range
where
num_letters = ['2'..'9'] ++ ['a'..'h'] ++ 'k' : ['m'..'z'] -- users have trouble distinguishing 1/l and 0/O so we eliminate these; apc has trouble distinguishing i/j and read "ji", "jf" as ligatures "ij", "fj" so we eliminate j as well
range = extra ++ num_letters
---------- ----------
-- Lens -- -- Lens --
---------- ----------