Skip to content

Commit 4d36ec9

Browse files
committed
Use the container_time_limit for the API build token
1 parent 4c55898 commit 4d36ec9

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

readthedocs/api/v2/models.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ def create_key(self, project):
1919
Build API keys are valid for 3 hours,
2020
and can be revoked at any time by hitting the /api/v2/revoke/ endpoint.
2121
"""
22-
# Use the build time limit + 15% for the API token
23-
expiry_date = timezone.now() + timedelta(seconds=settings.BUILD_TIME_LIMIT * 1.25)
22+
# Use the project or default build time limit + 15% for the API token
23+
delta = (project.container_time_limit or settings.BUILD_TIME_LIMIT) * 1.25
24+
expiry_date = timezone.now() + timedelta(seconds=delta)
2425
name_max_length = self.model._meta.get_field("name").max_length
2526
return super().create_key(
2627
# Name is required, so we use the project slug for it.

0 commit comments

Comments
 (0)