module Jobs.Handler.SetLogSettings
  ( dispatchJobSetLogSettings
  ) where

import Import

dispatchJobSetLogSettings :: InstanceId -> LogSettings -> JobHandler UniWorX
dispatchJobSetLogSettings jInstance jLogSettings = JobHandlerException $ do
  instanceId <- getsYesod appInstanceID
  unless (instanceId == jInstance) . liftIO $ fail "Incorrect instance"
  lSettings <- getsYesod appLogSettings
  atomically $ writeTVar lSettings jLogSettings
