summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2025-12-17 23:41:00 +0100
committerRory& <root@rory.gay>2025-12-17 23:41:00 +0100
commit587adef20e613284f0d8804a0f51c54658744fbd (patch)
tree673714e4d0b3363f4e87943c985844317a59933c /src
parentAvoid roundtrip when updating session (diff)
downloadserver-ts-587adef20e613284f0d8804a0f51c54658744fbd.tar.xz
trace checkToken
Diffstat (limited to 'src')
-rw-r--r--src/gateway/opcodes/Identify.ts14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/gateway/opcodes/Identify.ts b/src/gateway/opcodes/Identify.ts

index 022e4a76..a18f4350 100644 --- a/src/gateway/opcodes/Identify.ts +++ b/src/gateway/opcodes/Identify.ts
@@ -86,16 +86,21 @@ export async function onIdentify(this: WebSocket, data: Payload) { this.large_threshold = identify.large_threshold || 250; const parseAndValidateTime = taskSw.getElapsedAndReset(); - const tokenData = await checkToken(identify.token, { - relations: ["relationships", "relationships.to", "settings"], - select: [...PrivateUserProjection, "relationships", "rights"], - }); + const { result: tokenData, elapsed: checkTokenTime } = await timePromise(() => + checkToken(identify.token, { + relations: ["relationships", "relationships.to", "settings"], + select: [...PrivateUserProjection, "relationships", "rights"], + }), + ); + + taskSw.reset(); // don't include checkToken time... const user = tokenData.user; if (!user) { console.log("[Gateway] Failed to identify user"); return this.close(CLOSECODES.Authentication_failed); } + this.user_id = user.id; this.session = tokenData.session; const userQueryTime = taskSw.getElapsedAndReset(); @@ -582,6 +587,7 @@ export async function onIdentify(this: WebSocket, data: Payload) { ] as TraceRoot; const times = { parseAndValidateTime, + checkTokenTime, userQueryTime, validateIntentsAndShardingTime, createSessionTime,