Page MenuHomePhabricator

D11375.id38291.diff
No OneTemporary

D11375.id38291.diff

diff --git a/keyserver/src/socket/tunnelbroker-socket.js b/keyserver/src/socket/tunnelbroker-socket.js
--- a/keyserver/src/socket/tunnelbroker-socket.js
+++ b/keyserver/src/socket/tunnelbroker-socket.js
@@ -33,6 +33,7 @@
connected: boolean;
promises: Promises;
heartbeatTimeoutID: ?TimeoutID;
+ oneTimeKeysPromise: ?Promise<void>;
constructor(socketURL: string, initMessage: ConnectionInitializationMessage) {
this.connected = false;
@@ -108,7 +109,7 @@
const messageToKeyserver = JSON.parse(payload);
if (refreshKeysRequestValidator.is(messageToKeyserver)) {
const request: RefreshKeyRequest = messageToKeyserver;
- await uploadNewOneTimeKeys(request.numberOfKeys);
+ this.refreshOneTimeKeys(request.numberOfKeys);
}
} catch (e) {
console.error(
@@ -150,6 +151,14 @@
}
};
+ refreshOneTimeKeys: (numberOfKeys: number) => void = numberOfKeys => {
+ const oldOneTimeKeysPromise = this.oneTimeKeysPromise;
+ this.oneTimeKeysPromise = (async () => {
+ await oldOneTimeKeysPromise;
+ await uploadNewOneTimeKeys(numberOfKeys);
+ })();
+ };
+
sendMessage: (message: ClientMessageToDevice) => Promise<void> = (
message: ClientMessageToDevice,
) => {

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 29, 5:41 PM (20 h, 52 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2597663
Default Alt Text
D11375.id38291.diff (1 KB)

Event Timeline