File tree Expand file tree Collapse file tree 2 files changed +12
-8
lines changed
Expand file tree Collapse file tree 2 files changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -1684,15 +1684,18 @@ ackQueueMessage :: AgentClient -> RcvQueue -> SMP.MsgId -> AM ()
16841684ackQueueMessage c rq@ RcvQueue {userId, connId, server} srvMsgId = do
16851685 atomically $ incSMPServerStat c userId server ackAttempts
16861686 tryAgentError (sendAck c rq srvMsgId) >>= \ case
1687- Right _ -> do
1688- atomically $ incSMPServerStat c userId server ackMsgs
1689- whenM (liftIO $ hasGetLock c rq) $ do
1690- brokerTs_ <- (Just <$> withStore c (\ db -> getRcvMsgBrokerTs db connId srvMsgId)) `catchAgentError` \ _ -> pure Nothing
1691- atomically $ writeTBQueue (subQ c) (" " , connId, AEvt SAEConn $ MSGNTF srvMsgId brokerTs_)
1692- Left (SMP _ SMP. NO_MSG ) -> atomically $ incSMPServerStat c userId server ackNoMsgErrs
1687+ Right _ -> sendMsgNtf ackMsgs
1688+ Left (SMP _ SMP. NO_MSG ) -> sendMsgNtf ackNoMsgErrs
16931689 Left e -> do
16941690 unless (temporaryOrHostError e) $ atomically $ incSMPServerStat c userId server ackOtherErrs
16951691 throwE e
1692+ where
1693+ sendMsgNtf stat = do
1694+ atomically $ incSMPServerStat c userId server stat
1695+ whenM (liftIO $ hasGetLock c rq) $ do
1696+ atomically $ releaseGetLock c rq
1697+ brokerTs_ <- eitherToMaybe <$> tryAgentError (withStore c $ \ db -> getRcvMsgBrokerTs db connId srvMsgId)
1698+ atomically $ writeTBQueue (subQ c) (" " , connId, AEvt SAEConn $ MSGNTF srvMsgId brokerTs_)
16961699
16971700-- | Suspend SMP agent connection (OFF command) in Reader monad
16981701suspendConnection' :: AgentClient -> ConnId -> AM ()
Original file line number Diff line number Diff line change @@ -92,6 +92,7 @@ module Simplex.Messaging.Agent.Client
9292 hasActiveSubscription ,
9393 hasPendingSubscription ,
9494 hasGetLock ,
95+ releaseGetLock ,
9596 activeClientSession ,
9697 agentClientStore ,
9798 agentDRG ,
@@ -1647,8 +1648,8 @@ disableQueuesNtfs = sendTSessionBatches "NDEL" snd disableQueues_
16471648
16481649sendAck :: AgentClient -> RcvQueue -> MsgId -> AM ()
16491650sendAck c rq@ RcvQueue {rcvId, rcvPrivateKey} msgId =
1650- withSMPClient c rq (" ACK:" <> logSecret' msgId) ( \ smp -> ackSMPMessage smp rcvPrivateKey rcvId msgId)
1651- `agentFinally` atomically (releaseGetLock c rq)
1651+ withSMPClient c rq (" ACK:" <> logSecret' msgId) $ \ smp ->
1652+ ackSMPMessage smp rcvPrivateKey rcvId msgId
16521653
16531654hasGetLock :: AgentClient -> RcvQueue -> IO Bool
16541655hasGetLock c RcvQueue {server, rcvId} =
You can’t perform that action at this time.
0 commit comments