16 lines
436 B
Haskell
16 lines
436 B
Haskell
module Jobs.Handler.ExternalApis
|
|
( dispatchJobExternalApiExpire
|
|
) where
|
|
|
|
import Import
|
|
|
|
|
|
dispatchJobExternalApiExpire :: ExternalApiId -> Handler ()
|
|
dispatchJobExternalApiExpire apiId = do
|
|
now <- liftIO getCurrentTime
|
|
expiry <- getsYesod $ view _appExternalApisExpiry
|
|
void . runDB . runMaybeT $ do
|
|
ExternalApi{..} <- MaybeT $ get apiId
|
|
guard $ externalApiLastAlive <= addUTCTime (- expiry) now
|
|
lift $ delete apiId
|