Page MenuHomePhabricator

D13563.id44796.diff
No OneTemporary

D13563.id44796.diff

diff --git a/lib/tunnelbroker/peer-to-peer-context.js b/lib/tunnelbroker/peer-to-peer-context.js
--- a/lib/tunnelbroker/peer-to-peer-context.js
+++ b/lib/tunnelbroker/peer-to-peer-context.js
@@ -290,8 +290,10 @@
[allPeerDevices],
);
- const processOutboundMessages = React.useCallback(
- (
+ const processOutboundMessagesLatestVersionRef = React.useRef(-1);
+ const processOutboundMessages = React.useMemo(() => {
+ const currentVersion = ++processOutboundMessagesLatestVersionRef.current;
+ return (
outboundMessageIDs: ?$ReadOnlyArray<string>,
dmOpID: ?string,
notificationsCreationData: ?NotificationsCreationData,
@@ -306,6 +308,11 @@
promiseRunning.current = true;
void (async () => {
do {
+ if (
+ currentVersion !== processOutboundMessagesLatestVersionRef.current
+ ) {
+ break;
+ }
const queueFront = processingQueue.current.shift();
try {
const [result] = await Promise.all([
@@ -343,15 +350,14 @@
promiseRunning.current = false;
})();
}
- },
- [
- allPeerDevicesSet,
- sendMessageToDevice,
- identityContext,
- peerOlmSessionsCreator,
- sendPushNotifs,
- ],
- );
+ };
+ }, [
+ allPeerDevicesSet,
+ sendMessageToDevice,
+ identityContext,
+ peerOlmSessionsCreator,
+ sendPushNotifs,
+ ]);
const broadcastEphemeralMessage = React.useCallback(
async (

File Metadata

Mime Type
text/plain
Expires
Fri, Oct 4, 9:22 AM (21 h, 55 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2232101
Default Alt Text
D13563.id44796.diff (1 KB)

Event Timeline