Skip to content

Commit

Permalink
use replace strategy to trigger proper session cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
sechmann committed Jul 8, 2024
1 parent ad91239 commit dace180
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
9 changes: 3 additions & 6 deletions internal/apiserver/database/queries/sessions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,9 @@ ORDER BY s.expiry DESC
LIMIT 1;

-- name: AddSession :exec
INSERT INTO sessions (key, expiry, device_id, object_id)
VALUES (@key, @expiry, @device_id, @object_id)
ON CONFLICT (device_id) DO UPDATE
SET key = excluded.key,
expiry = excluded.expiry,
object_id = excluded.object_id;
INSERT OR REPLACE INTO sessions (key, expiry, device_id, object_id)
VALUES (@key, @expiry, @device_id, @object_id);


-- name: AddSessionAccessGroupID :exec
INSERT INTO session_access_group_ids (session_key, group_id)
Expand Down
6 changes: 1 addition & 5 deletions internal/apiserver/sqlc/sessions.sql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit dace180

Please sign in to comment.