Skip to content

Commit

Permalink
Tasks: delete closed PRs every 30 minutes (#11563)
Browse files Browse the repository at this point in the history
* Tasks: delete closed PRs every 30 minutes

* Delete old first

* Rename task
  • Loading branch information
stsewd authored Aug 26, 2024
1 parent 57c024d commit a61329c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion readthedocs/builds/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ def delete_closed_external_versions(limit=200, days=30 * 3):
queryset = Version.external.filter(
state=EXTERNAL_VERSION_STATE_CLOSED,
modified__lte=days_ago,
)[:limit]
).order_by("modified")[:limit]
for version in queryset:
try:
last_build = version.last_build
Expand Down
4 changes: 2 additions & 2 deletions readthedocs/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,11 +546,11 @@ def TEMPLATES(self):
"delete": True,
},
},
"every-three-hours-delete-inactive-external-versions": {
"every-30m-delete-inactive-external-versions": {
"task": "readthedocs.builds.tasks.delete_closed_external_versions",
# Increase the frequency because we have 255k closed versions and they keep growing.
# It's better to increase this frequency than the `limit=` of the task.
"schedule": crontab(minute=0, hour="*/3"),
"schedule": crontab(minute="*/30", hour="*"),
"options": {"queue": "web"},
},
"every-day-resync-remote-repositories": {
Expand Down

0 comments on commit a61329c

Please sign in to comment.