ntf: remove notification subscription (#417)

This commit is contained in:
JRoberts
2022-06-22 20:32:32 +04:00
committed by GitHub
parent ffb4b4763c
commit ef4d4c9e16
8 changed files with 75 additions and 6 deletions
@@ -71,6 +71,14 @@ instance MonadQueueStore QueueStore STM where
TM.insert nId rId notifiers
pure $ Just q
deleteQueueNotifier :: QueueStore -> RecipientId -> STM (Either ErrorType ())
deleteQueueNotifier QueueStore {queues, notifiers} rId =
withQueue rId queues $ \qVar -> do
q <- readTVar qVar
forM_ (notifier q) $ \NtfCreds {notifierId} -> TM.delete notifierId notifiers
writeTVar qVar q {notifier = Nothing}
pure $ Just ()
suspendQueue :: QueueStore -> RecipientId -> STM (Either ErrorType ())
suspendQueue QueueStore {queues} rId =
withQueue rId queues $ \qVar -> modifyTVar' qVar (\q -> q {status = QueueOff}) $> Just ()