Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: purge expired api keys in dbpurge#20863

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Emyrk merged 10 commits intomainfromstevenmasley/purge_expired_keys
Nov 24, 2025

Conversation

@Emyrk
Copy link
Member

@EmyrkEmyrk commentedNov 21, 2025
edited
Loading

closes#19889

This is in response to a migration in v2.27 that takes very long on deployments with largeapi_key tables.

Comment on lines 89 to 90
// TODO: Arbitrary numbers are arbitrary...
LimitCount:10000,
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

We know anapi_key migration takes so long it can timeout.

I don't like arbitrary numbers, but if this table is massive, we should spread the load out. DB purge runs every 10 minutes. 10k feels large, but not insane to be too slow?

Comment on lines 82 to 86
// Leave expired keys for a week to allow the backend to know the difference
// between a 404 and an expired key. This purge code is just to bound the size of
// the table to something more reasonable.
// TODO: Does this matter?
Before:dbtime.Time(start.Add(time.Hour*24*7*-1)),
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

There is a behavior change if we purge expired keys. And I wonder if the difference between 404 & expired is good information.

@Emyrk
Copy link
MemberAuthor

Emyrk commentedNov 21, 2025
edited
Loading

oauth2_provider_app_tokens referencesapi_keys. I think we can't just delete without deleting the app_token too. Will write a test and check

We are good. The oauth token is also deleted from theDELETE CASCADE

ALTER TABLE ONLY oauth2_provider_app_tokens    ADD CONSTRAINT oauth2_provider_app_tokens_api_key_id_fkey FOREIGN KEY (api_key_id) REFERENCES api_keys(id) ON DELETE CASCADE;

@EmyrkGraphite App
Copy link
MemberAuthor

Emyrk commentedNov 21, 2025
edited
Loading

@EmyrkEmyrkforce-pushed thestevenmasley/purge_expired_keys branch fromceb15c5 to11bf986CompareNovember 21, 2025 16:29
@EmyrkEmyrk marked this pull request as ready for reviewNovember 21, 2025 16:35
@EmyrkEmyrkforce-pushed thestevenmasley/purge_expired_keys branch from0cd1c02 to43290cdCompareNovember 21, 2025 17:55
@EmyrkEmyrk merged commitcefe07d intomainNov 24, 2025
31 checks passed
@EmyrkEmyrk deleted the stevenmasley/purge_expired_keys branchNovember 24, 2025 16:24
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsNov 24, 2025
@EmyrkEmyrk added cherry-pick/v2.29Needs to be cherry-picked to the 2.29 release branch and removed cherry-pick/v2.29Needs to be cherry-picked to the 2.29 release branch labelsDec 1, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

@dannykoppingdannykoppingdannykopping approved these changes

@spikecurtisspikecurtisAwaiting requested review from spikecurtis

Assignees

@EmyrkEmyrk

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

dbpurge: purge expired api keys

3 participants

@Emyrk@dannykopping

[8]ページ先頭

©2009-2025 Movatter.jp