on master help sign in
Use STM binding for matchingMsgs list comprehension
f931cbciko
server.knot+2−3
@@ -823,10 +823,9 @@ pollOnce = \token cursor -> do
823 yield (PollUnauthorized {})
823 yield (PollUnauthorized {})
824 Authorized {pubkey} -> do
824 Authorized {pubkey} -> do
825 seqCounter <- *seqCounter
825 seqCounter <- *seqCounter
826− messages <- *messages
827 let clampedCursor = clamp 0 (max seqCounter t) cursor
826 let clampedCursor = clamp 0 (max seqCounter t) cursor
828− let matchingMsgs = do
827+ matchingMsgs <- do
829− m <- messages
828+ m <- *messages
830 where m.toKey == pubkey && m.receivedAt >= t - messageMaxAge && m.receivedAt > clampedCursor
829 where m.toKey == pubkey && m.receivedAt >= t - messageMaxAge && m.receivedAt > clampedCursor
831 yield m
830 yield m
832 let limitedMsgs = boundedSmallest matchingMsgs maxPollEvents (\m -> m.receivedAt)
831 let limitedMsgs = boundedSmallest matchingMsgs maxPollEvents (\m -> m.receivedAt)