mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-18 21:45:31 +09:00
perf(user): stop double-writing last active on every request (#2148)
This commit is contained in:
1 parent
bac06fe182
commit
e83a2d6aec
13 files changed
+80
-56
No files matched your search
@@ -112,17 +112,6 @@ export const UserMiddleware = createMiddleware<HonoEnv>(async (ctx, next) => {
|
||||
if (authSession) {
|
||||
void AuthSession.updateAuthSessionLastUsed(apiContext, authSession.sessionIdHash);
|
||||
const user = await apiContext.services.users.findUniqueAssert(authSession.userId);
|
||||
const sessionId = Buffer.from(authSession.sessionIdHash).toString('base64url');
|
||||
void AuthSession.updateUserActivity(apiContext, {
|
||||
userId: authSession.userId,
|
||||
clientIp: resolvedClientIp,
|
||||
user,
|
||||
action: 'session_authenticated',
|
||||
tokenType: 'session',
|
||||
sessionId,
|
||||
}).catch((error: unknown) => {
|
||||
Logger.warn({error, userId: authSession.userId}, 'Failed to update user activity telemetry');
|
||||
});
|
||||
ctx.set('authSession', authSession);
|
||||
ctx.set('authTokenType', 'session');
|
||||
setUserInContext(ctx, user, true);
|
||||
|
||||
Reference in new issue
Block a user