Skip to content

Commit b3770d3

Browse files
JacobCoffeeclaude
andcommitted
fix: add fallback to purge_url when FASTLY_SERVICE_ID is not configured
Prevents silent no-op regression when surrogate key purging is not available. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 9b8dbcf commit b3770d3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

apps/downloads/models.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,11 @@ def purge_fastly_download_pages(sender, instance, **kwargs):
303303
if instance.is_published:
304304
# Purge all /downloads/* pages via surrogate key (preferred method)
305305
# This catches everything: /downloads/android/, /downloads/release/*, etc.
306-
purge_surrogate_key("downloads")
306+
# Falls back to purge_url if FASTLY_SERVICE_ID is not configured.
307+
if getattr(settings, "FASTLY_SERVICE_ID", None):
308+
purge_surrogate_key("downloads")
309+
else:
310+
purge_url("/downloads/")
307311

308312
# Also purge related pages outside /downloads/
309313
purge_url("/ftp/python/")

0 commit comments

Comments
 (0)