mirror of
https://github.com/simplex-chat/simplexmq.git
synced 2026-06-06 01:51:45 +00:00
use TMap for subscription maps (#341)
* use TMap for subscription maps * refactor * correction
This commit is contained in:
committed by
GitHub
parent
6ef6bedc03
commit
cd22e06b3a
@@ -114,9 +114,9 @@ newEnv config@ServerConfig {caCertificateFile, certificateFile, privateKeyFile}
|
||||
restoreQueues QueueStore {queues, senders, notifiers} s = do
|
||||
(qs, s') <- liftIO $ readWriteStoreLog s
|
||||
atomically $ do
|
||||
writeTVar (TM.tVar queues) =<< mapM newTVar qs
|
||||
writeTVar (TM.tVar senders) $ M.foldr' addSender M.empty qs
|
||||
writeTVar (TM.tVar notifiers) $ M.foldr' addNotifier M.empty qs
|
||||
writeTVar queues =<< mapM newTVar qs
|
||||
writeTVar senders $ M.foldr' addSender M.empty qs
|
||||
writeTVar notifiers $ M.foldr' addNotifier M.empty qs
|
||||
pure s'
|
||||
addSender :: QueueRec -> Map SenderId RecipientId -> Map SenderId RecipientId
|
||||
addSender q = M.insert (senderId q) (recipientId q)
|
||||
|
||||
Reference in New Issue
Block a user