16 lines
469 B
Haskell
16 lines
469 B
Haskell
module Jobs.Handler.PruneInvitations
|
|
( dispatchJobPruneInvitations
|
|
) where
|
|
|
|
import Import
|
|
|
|
import Database.Persist.Sql (deleteWhereCount)
|
|
|
|
dispatchJobPruneInvitations :: JobHandler UniWorX
|
|
dispatchJobPruneInvitations = JobHandlerAtomicWithFinalizer act fin
|
|
where
|
|
act = hoist lift $ do
|
|
now <- liftIO getCurrentTime
|
|
deleteWhereCount [ InvitationExpiresAt <. Just now ]
|
|
fin n = $logInfoS "PruneInvitations" [st|Deleted #{n} expired invitations|]
|