Page MenuHomePhabricator

D9548.diff
No OneTemporary

D9548.diff

diff --git a/keyserver/src/session/cookies.js b/keyserver/src/session/cookies.js
--- a/keyserver/src/session/cookies.js
+++ b/keyserver/src/session/cookies.js
@@ -725,8 +725,9 @@
await createSession(viewer, calendarQuery, initialLastUpdate);
}
-async function extendCookieLifespan(cookieID: string) {
+async function updateCookie(viewer: Viewer) {
const time = Date.now();
+ const { cookieID } = viewer;
const query = SQL`
UPDATE cookies SET last_used = ${time} WHERE id = ${cookieID}
`;
@@ -744,7 +745,7 @@
viewer.cookieInvalidated = false;
}
if (!viewer.getData().cookieInsertedThisRequest) {
- handleAsyncPromise(extendCookieLifespan(viewer.cookieID));
+ handleAsyncPromise(updateCookie(viewer));
}
if (viewer.sessionChanged) {
addSessionChangeInfoToResult(viewer, res, result, appURLFacts);
@@ -759,7 +760,7 @@
appURLFacts: AppURLFacts,
) {
if (!viewer.getData().cookieInsertedThisRequest) {
- handleAsyncPromise(extendCookieLifespan(viewer.cookieID));
+ handleAsyncPromise(updateCookie(viewer));
}
addActualHTTPCookie(viewer, res, appURLFacts);
}
@@ -879,7 +880,7 @@
createNewAnonymousCookie,
createNewUserCookie,
setNewSession,
- extendCookieLifespan,
+ updateCookie,
addCookieToJSONResponse,
addCookieToHomeResponse,
setCookieSignedIdentityKeysBlob,
diff --git a/keyserver/src/socket/socket.js b/keyserver/src/socket/socket.js
--- a/keyserver/src/socket/socket.js
+++ b/keyserver/src/socket/socket.js
@@ -73,7 +73,7 @@
import { handleAsyncPromise } from '../responders/handlers.js';
import {
fetchViewerForSocket,
- extendCookieLifespan,
+ updateCookie,
createNewAnonymousCookie,
isCookieMissingSignedIdentityKeysBlob,
isCookieMissingOlmNotificationsSession,
@@ -254,7 +254,7 @@
throw new ServerError('session_mutated_from_socket');
}
if (clientSocketMessage.type !== clientSocketMessageTypes.PING) {
- handleAsyncPromise(extendCookieLifespan(viewer.cookieID));
+ handleAsyncPromise(updateCookie(viewer));
}
for (const response of serverResponses) {
// Normally it's an anti-pattern to await in sequence like this. But in

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 30, 5:27 AM (21 h, 58 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2599761
Default Alt Text
D9548.diff (2 KB)

Event Timeline