Skip to content

Commit cf4b9f6

Browse files
committed
agent: always enable periodic notifications
1 parent e417d35 commit cf4b9f6

File tree

3 files changed

+3
-9
lines changed

3 files changed

+3
-9
lines changed

src/Simplex/Messaging/Agent.hs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2268,10 +2268,8 @@ verifyNtfToken' c deviceToken nonce code =
22682268
_ -> throwE $ CMD PROHIBITED "verifyNtfToken: no token"
22692269

22702270
setCronInterval :: AgentClient -> NtfTokenId -> NtfToken -> AM' ()
2271-
setCronInterval c tknId tkn@NtfToken {ntfMode} = do
2272-
cron <- case ntfMode of
2273-
NMPeriodic -> asks $ ntfCron . config
2274-
_ -> pure 0
2271+
setCronInterval c tknId tkn = do
2272+
cron <- asks $ ntfCron . config
22752273
void $ forkIO $ void $ runExceptT $ agentNtfSetCronInterval c tknId tkn cron
22762274

22772275
checkNtfToken' :: AgentClient -> DeviceToken -> AM NtfTknStatus

src/Simplex/Messaging/Notifications/Protocol.hs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,6 @@ instance StrEncoding NtfSubStatus where
521521
strP = smpP
522522
{-# INLINE strP #-}
523523

524-
-- TODO [ntfdb] check what happens in agent when token in not yet registered
525524
data NtfTknStatus
526525
= -- | Token created in DB
527526
NTNew
@@ -541,7 +540,7 @@ allowNtfSubCommands :: NtfTknStatus -> Bool
541540
allowNtfSubCommands = \case
542541
NTNew -> False
543542
NTRegistered -> False
544-
-- TODO [ntfdb] we could have separate statuses to show whether it became invalid
543+
-- TODO we could have separate statuses to show whether it became invalid
545544
-- after verification (allow commands) or before (do not allow)
546545
NTInvalid _ -> True
547546
NTConfirmed -> False

src/Simplex/Messaging/Notifications/Server.hs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,6 @@ ntfSubscriber NtfSubscriber {smpSubscribers, newSubQ, smpAgent = ca@SMPClientAge
491491
let newNtf = PNMessageData {smpQueue, ntfTs, nmsgNonce, encNMsgMeta}
492492
ntfs_ <- liftIO $ addTokenLastNtf st newNtf
493493
forM_ ntfs_ $ \(tkn, lastNtfs) -> atomically $ writeTBQueue pushQ (tkn, PNMessage lastNtfs)
494-
-- TODO [ntfdb] count queued notifications separately?
495494
incNtfStat ntfReceived
496495
Right SMP.END -> do
497496
whenM (atomically $ activeClientSession' ca sessionId srv) $ do
@@ -604,8 +603,6 @@ ntfPush s@NtfPushServer {pushQ} = forever $ do
604603
_ -> err e
605604
err e = logError ("Push provider error (" <> tshow pp <> ", " <> tshow ntfTknId <> "): " <> tshow e) $> Left e
606605

607-
-- TODO [ntfdb] this could be further improved by sending periodic notifications directly from this thread,
608-
-- without any queue
609606
periodicNtfsThread :: NtfPushServer -> M ()
610607
periodicNtfsThread NtfPushServer {pushQ} = do
611608
st <- asks store

0 commit comments

Comments
 (0)