File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
src/sentry/runner/commands Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -316,7 +316,9 @@ def remove_expired_values_for_org_members(
316
316
317
317
318
318
def delete_api_models (is_filtered : Callable [[type [Model ]], bool ]) -> None :
319
+ from sentry .models .apigrant import DEFAULT_EXPIRATION as API_GRANT_EXPIRATION
319
320
from sentry .models .apigrant import ApiGrant
321
+ from sentry .models .apitoken import DEFAULT_EXPIRATION as API_TOKEN_EXPIRATION
320
322
from sentry .models .apitoken import ApiToken
321
323
322
324
for model_tp in (ApiGrant , ApiToken ):
@@ -325,8 +327,11 @@ def delete_api_models(is_filtered: Callable[[type[Model]], bool]) -> None:
325
327
if is_filtered (model_tp ):
326
328
debug_output (f">> Skipping { model_tp .__name__ } " )
327
329
else :
330
+ expiration_threshold = (
331
+ API_GRANT_EXPIRATION if model_tp is ApiGrant else API_TOKEN_EXPIRATION
332
+ )
328
333
queryset = model_tp .objects .filter (
329
- expires_at__lt = (timezone .now () - timedelta ( days = API_TOKEN_TTL_IN_DAYS ) )
334
+ expires_at__lt = (timezone .now () - expiration_threshold )
330
335
)
331
336
332
337
# SentryAppInstallations are associated to ApiTokens. We're okay
You can’t perform that action at this time.
0 commit comments