fix: handle large terminated sessions caching with pagination to prevent RAM overflow;
feat: add paginated query for terminated sessions GUIDs with limit and offset; refactor: batch processing terminated sessions in Redis with pipeline; chore: log batch caching progress for terminated sessions; fix: set TTL for session termination cache keys (8 hours); refactor: update SQL query for terminated sessions to use pagination; fix: correct loop structure in auth service initialization
This commit is contained in:
@@ -253,11 +253,13 @@ WHERE
|
||||
user_id = $1 AND terminated IS FALSE AND
|
||||
last_refresh_exp_time > CURRENT_TIMESTAMP;
|
||||
|
||||
;-- name: GetUnexpiredTerminatedSessionsGuids :many
|
||||
-- name: GetUnexpiredTerminatedSessionsGuidsPaginated :many
|
||||
SELECT guid FROM sessions
|
||||
WHERE
|
||||
terminated IS TRUE AND
|
||||
last_refresh_exp_time > CURRENT_TIMESTAMP;
|
||||
last_refresh_exp_time > CURRENT_TIMESTAMP
|
||||
LIMIT @batch_size::integer
|
||||
OFFSET $2;
|
||||
|
||||
;-- name: TerminateAllSessionsForUserByUsername :many
|
||||
UPDATE sessions
|
||||
|
||||
Reference in New Issue
Block a user