diff --git a/config/develop-settings.yml b/config/develop-settings.yml index d1c3c61f8..3b16a381d 100644 --- a/config/develop-settings.yml +++ b/config/develop-settings.yml @@ -8,7 +8,7 @@ # 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: times: [12] @@ -17,14 +17,16 @@ avs-licence-synch: max-changes: 999 mail-reroute-to: - name: FRADrive-QA-Umleitungen - email: FRADrive-TEST-Umleitungen@fraport.de + name: "FRADrive-QA-Umleitungen" + email: "FRADrive-TEST-Umleitungen@fraport.de" # Enqueue at specified hour, a few minutes later job-lms-qualifications-enqueue-hour: 16 job-lms-qualifications-dequeue-hour: 4 -job-mode: - tag: offload -job-workers: 1 -job-flush-interval: 600 \ No newline at end of file +# Using these setting kills the job-workers somehow +# job-workers: 5 +# job-flush-interval: 600 +# job-stale-threshold: 3600 +# job-move-threshold: 60 + diff --git a/src/Handler/Utils/LMS.hs b/src/Handler/Utils/LMS.hs index 59aca7859..b51aec748 100644 --- a/src/Handler/Utils/LMS.hs +++ b/src/Handler/Utils/LMS.hs @@ -43,9 +43,6 @@ import qualified Data.Set as Set (notMember) import qualified Database.Esqueleto.Legacy 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 = do @@ -182,12 +179,6 @@ lengthPassword = 8 maxLmsUserIdentRetries :: Int 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 -- import qualified Data.Elocrypt as Elo diff --git a/src/Jobs/Handler/SendTestEmail.hs b/src/Jobs/Handler/SendTestEmail.hs index 77b53db23..36e9780c7 100644 --- a/src/Jobs/Handler/SendTestEmail.hs +++ b/src/Jobs/Handler/SendTestEmail.hs @@ -70,6 +70,7 @@ dispatchJobSleep :: Int -> JobHandler UniWorX dispatchJobSleep sleepTime = JobHandlerAtomic act where 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) - $logInfoS "JOBS" [st|Sleep job #{sleepTime}s ended.|] \ No newline at end of file + $logInfoS "JOBS" [st|Sleep job #{tag} for #{sleepTime}s ended.|] \ No newline at end of file diff --git a/src/Settings.hs b/src/Settings.hs index 8296eda61..bd553255e 100644 --- a/src/Settings.hs +++ b/src/Settings.hs @@ -863,10 +863,12 @@ widgetFile -- | Raw bytes at compile time of @config/settings.yml@ (and also @config/develop-setting.yml for development builds) configSettingsYmlBS :: ByteString -configSettingsYmlBS = $(embedFile configSettingsYml) +configSettingsYmlBS = #ifdef DEVELOPMENT - <> $(embedFile "config/develop-settings.yml") + $(embedFile "config/develop-settings.yml") <> #endif + $(embedFile configSettingsYml) + -- | @config/settings.yml@, parsed to a @Value@. configSettingsYmlValue :: Value diff --git a/src/Utils.hs b/src/Utils.hs index a4e477ae9..d89688145 100644 --- a/src/Utils.hs +++ b/src/Utils.hs @@ -130,6 +130,7 @@ import Data.Constraint (Dict(..)) import Control.Monad.Random.Class (MonadSplit(getSplit), MonadRandom, MonadInterleave(interleave), uniform) import Control.Monad.Random (RandomGen) +import Control.Monad.Trans.Random (evalRandTIO) import qualified System.Random.Shuffle as Rand (shuffleM) 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 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 -- ----------