mirror of
https://github.com/simplex-chat/simplexmq.git
synced 2026-05-14 05:25:07 +00:00
agent: always enable periodic notifications
This commit is contained in:
@@ -2268,10 +2268,8 @@ verifyNtfToken' c deviceToken nonce code =
|
||||
_ -> throwE $ CMD PROHIBITED "verifyNtfToken: no token"
|
||||
|
||||
setCronInterval :: AgentClient -> NtfTokenId -> NtfToken -> AM' ()
|
||||
setCronInterval c tknId tkn@NtfToken {ntfMode} = do
|
||||
cron <- case ntfMode of
|
||||
NMPeriodic -> asks $ ntfCron . config
|
||||
_ -> pure 0
|
||||
setCronInterval c tknId tkn = do
|
||||
cron <- asks $ ntfCron . config
|
||||
void $ forkIO $ void $ runExceptT $ agentNtfSetCronInterval c tknId tkn cron
|
||||
|
||||
checkNtfToken' :: AgentClient -> DeviceToken -> AM NtfTknStatus
|
||||
|
||||
@@ -521,7 +521,6 @@ instance StrEncoding NtfSubStatus where
|
||||
strP = smpP
|
||||
{-# INLINE strP #-}
|
||||
|
||||
-- TODO [ntfdb] check what happens in agent when token in not yet registered
|
||||
data NtfTknStatus
|
||||
= -- | Token created in DB
|
||||
NTNew
|
||||
@@ -541,7 +540,7 @@ allowNtfSubCommands :: NtfTknStatus -> Bool
|
||||
allowNtfSubCommands = \case
|
||||
NTNew -> False
|
||||
NTRegistered -> False
|
||||
-- TODO [ntfdb] we could have separate statuses to show whether it became invalid
|
||||
-- TODO we could have separate statuses to show whether it became invalid
|
||||
-- after verification (allow commands) or before (do not allow)
|
||||
NTInvalid _ -> True
|
||||
NTConfirmed -> False
|
||||
|
||||
@@ -491,7 +491,6 @@ ntfSubscriber NtfSubscriber {smpSubscribers, newSubQ, smpAgent = ca@SMPClientAge
|
||||
let newNtf = PNMessageData {smpQueue, ntfTs, nmsgNonce, encNMsgMeta}
|
||||
ntfs_ <- liftIO $ addTokenLastNtf st newNtf
|
||||
forM_ ntfs_ $ \(tkn, lastNtfs) -> atomically $ writeTBQueue pushQ (tkn, PNMessage lastNtfs)
|
||||
-- TODO [ntfdb] count queued notifications separately?
|
||||
incNtfStat ntfReceived
|
||||
Right SMP.END -> do
|
||||
whenM (atomically $ activeClientSession' ca sessionId srv) $ do
|
||||
@@ -604,8 +603,6 @@ ntfPush s@NtfPushServer {pushQ} = forever $ do
|
||||
_ -> err e
|
||||
err e = logError ("Push provider error (" <> tshow pp <> ", " <> tshow ntfTknId <> "): " <> tshow e) $> Left e
|
||||
|
||||
-- TODO [ntfdb] this could be further improved by sending periodic notifications directly from this thread,
|
||||
-- without any queue
|
||||
periodicNtfsThread :: NtfPushServer -> M ()
|
||||
periodicNtfsThread NtfPushServer {pushQ} = do
|
||||
st <- asks store
|
||||
|
||||
Reference in New Issue
Block a user