MCPcopy Index your code
hub / github.com/sourcebot-dev/sourcebot / updateUserLastActiveAt

Function updateUserLastActiveAt

packages/web/src/middleware/withAuth.ts:114–130  ·  view source on GitHub ↗
(user: UserWithAccounts)

Source from the content-addressed store, hash-verified

112};
113
114const updateUserLastActiveAt = (user: UserWithAccounts) => {
115 const now = Date.now();
116 if (
117 user.lastActiveAt &&
118 (now - user.lastActiveAt.getTime()) < LAST_ACTIVE_AT_THRESHOLD_MS
119 ) {
120 return;
121 }
122
123 // Fired without a await to avoid blocking.
124 void __unsafePrisma.user
125 .update({
126 where: { id: user.id },
127 data: { lastActiveAt: new Date(now) },
128 })
129 .catch(() => { /* updaing the lastActiveAt is best effort. */ });
130};
131
132type AuthSource = 'session' | 'oauth' | 'api_key';
133

Callers 1

getAuthContextFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected