Validate UDS sessions every six hours

This commit is contained in:
oliver 2026-10-12 09:52:10 +08:00
parent df97c5e042
commit 2eb168442e
3 changed files with 44 additions and 0 deletions

View file

@ -280,6 +280,20 @@ export class MemoryStore extends SessionStore {
return this._publicRecord(this._purgeExpired(id))
}
async listUdsSessionsForValidation() {
const sessions = []
for (const [sessionId, record] of this._sessions) {
const row = this._purgeExpired(sessionId)
if (!row || row.kind !== 'uds') continue
sessions.push({
sessionId: row.sessionId,
empNo: row.empNo,
token: typeof row.userData?.token === 'string' ? row.userData.token : '',
})
}
return sessions
}
getBySessionIdSync(sessionId) {
const id = String(sessionId || '').trim()
if (!id) return null

View file

@ -27,6 +27,11 @@ export class SessionStore {
throw new Error('SessionStore#getBySessionId must be implemented')
}
/** Return active UDS sessions and their upstream token for periodic validation. */
async listUdsSessionsForValidation() {
throw new Error('SessionStore#listUdsSessionsForValidation must be implemented')
}
async touch(sessionId, ttlSeconds) {
throw new Error('SessionStore#touch must be implemented')
}