Created
November 16, 2023 18:09
-
-
Save marcinwasowicz/8a7f5d9171d3d2df7408f26176639be4 to your computer and use it in GitHub Desktop.
Simulate concurrent `sendPushNotifs` promises at the same time.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/keyserver/src/creators/message-creator.js b/keyserver/src/creators/message-creator.js | |
index db71a26ed..18caecf3e 100644 | |
--- a/keyserver/src/creators/message-creator.js | |
+++ b/keyserver/src/creators/message-creator.js | |
@@ -476,14 +476,21 @@ async function postMessageSend( | |
return undefined; | |
} | |
+ const messageInfos1 = []; | |
+ const messageDatas1 = []; | |
+ | |
+ for (const filteredMessageToNotify of filteredMessagesToNotify) { | |
+ const { messageInfo, messageData } = filteredMessageToNotify; | |
+ for (let i = 0; i < 3; i++) { | |
+ messageInfos1.push(messageInfo); | |
+ messageDatas1.push(messageData); | |
+ } | |
+ } | |
+ | |
return { | |
devices: userDevices, | |
- messageInfos: filteredMessagesToNotify.map( | |
- ({ messageInfo }) => messageInfo, | |
- ), | |
- messageDatas: filteredMessagesToNotify.map( | |
- ({ messageData }) => messageData, | |
- ), | |
+ messageInfos: messageInfos1, | |
+ messageDatas: messageDatas1, | |
}; | |
}; | |
@@ -507,8 +514,15 @@ async function postMessageSend( | |
processForSearch, | |
]); | |
+ const sendPromises = []; | |
+ for (let i = 0; i < 100; i++) { | |
+ sendPromises.push(sendPushNotifs(_pickBy(Boolean)(pushInfo))); | |
+ } | |
+ | |
+ await Promise.all(sendPromises); | |
+ | |
await Promise.all([ | |
- sendPushNotifs(_pickBy(Boolean)(pushInfo)), | |
+ // sendPushNotifs(_pickBy(Boolean)(pushInfo)), | |
sendRescindNotifs(_pickBy(Boolean)(rescindInfo)), | |
]); | |
} | |
diff --git a/lib/shared/version-utils.js b/lib/shared/version-utils.js | |
index e3fc8978e..f559163e3 100644 | |
--- a/lib/shared/version-utils.js | |
+++ b/lib/shared/version-utils.js | |
@@ -6,7 +6,7 @@ import { type PlatformDetails, isWebPlatform } from '../types/device-types.js'; | |
* A code version used for features that are waiting to be released | |
* and we're not sure in which version they will be available. | |
*/ | |
-const FUTURE_CODE_VERSION = 1000000; | |
+const FUTURE_CODE_VERSION = 0; | |
/** | |
* A code version used for features that are waiting to be included |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment