avoid redundant CanPush messages with different shas being queued up
This commit is contained in:
parent
c3cf6bef34
commit
f857c44b45
1 changed files with 5 additions and 3 deletions
|
@ -32,8 +32,9 @@ notifyNetMessagerRestart =
|
||||||
waitNetMessagerRestart :: Assistant ()
|
waitNetMessagerRestart :: Assistant ()
|
||||||
waitNetMessagerRestart = readSV <<~ (netMessagerRestart . netMessager)
|
waitNetMessagerRestart = readSV <<~ (netMessagerRestart . netMessager)
|
||||||
|
|
||||||
{- Store an important NetMessage for a client, and if an equivilant
|
{- Store a new important NetMessage for a client, and if an equivilant
|
||||||
- message was already sent, remove it from sentImportantNetMessages. -}
|
- older message is already stored, remove it from both importantNetMessages
|
||||||
|
- and sentImportantNetMessages. -}
|
||||||
storeImportantNetMessage :: NetMessage -> ClientID -> (ClientID -> Bool) -> Assistant ()
|
storeImportantNetMessage :: NetMessage -> ClientID -> (ClientID -> Bool) -> Assistant ()
|
||||||
storeImportantNetMessage m client matchingclient = go <<~ netMessager
|
storeImportantNetMessage m client matchingclient = go <<~ netMessager
|
||||||
where
|
where
|
||||||
|
@ -41,7 +42,8 @@ storeImportantNetMessage m client matchingclient = go <<~ netMessager
|
||||||
q <- takeTMVar $ importantNetMessages nm
|
q <- takeTMVar $ importantNetMessages nm
|
||||||
sent <- takeTMVar $ sentImportantNetMessages nm
|
sent <- takeTMVar $ sentImportantNetMessages nm
|
||||||
putTMVar (importantNetMessages nm) $
|
putTMVar (importantNetMessages nm) $
|
||||||
M.alter (Just . maybe (S.singleton m) (S.insert m)) client q
|
M.alter (Just . maybe (S.singleton m) (S.insert m)) client $
|
||||||
|
M.mapWithKey removematching sent q
|
||||||
putTMVar (sentImportantNetMessages nm) $
|
putTMVar (sentImportantNetMessages nm) $
|
||||||
M.mapWithKey removematching sent
|
M.mapWithKey removematching sent
|
||||||
removematching someclient s
|
removematching someclient s
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue