-
Notifications
You must be signed in to change notification settings - Fork 1.1k
feat(coderd/database/dbpurge): make API keys retention configurable #21037
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
008a48a to
03f5ec5
Compare
07ae594 to
9ca58c3
Compare
9ca58c3 to
a21395a
Compare
03f5ec5 to
46f07e1
Compare
a21395a to
82f1c2b
Compare
46f07e1 to
27c90dd
Compare
| user_id = $1; | ||
|
|
||
| -- name: DeleteExpiredAPIKeys :one | ||
| -- name: DeleteExpiredAPIKeys :execrows |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
woah TIL!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dannykopping have you seen this annotation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't! Those crows should watch out... 🐦⬛
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
crows.exe is beakoning.
82f1c2b to
2ce8f62
Compare
27c90dd to
1bed429
Compare
8cb020d to
2a45adb
Compare
API keys retention is now explicit - it's enabled when --api-keys-retention is set to a non-zero duration (default 7d), and disabled when set to 0. No fallback to global retention.
Use :execrows instead of :one to simplify the query by removing the extra CTE wrapper. This lets PostgreSQL return the row count directly via RowsAffected() instead of requiring an explicit COUNT(*) scan.
1bed429 to
a6744f0
Compare
Replace hardcoded 7-day retention for expired API keys with configurable
retention from deployment settings. Skips deletion entirely when effective retention is 0.
Depends on #21021
Updates #20743
PR Stack
workspace_agent_logs