diff options
Diffstat (limited to 'webmentions_ssg')
| -rw-r--r-- | webmentions_ssg/tasks/scanner.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/webmentions_ssg/tasks/scanner.py b/webmentions_ssg/tasks/scanner.py index e8149ba..7e163f7 100644 --- a/webmentions_ssg/tasks/scanner.py +++ b/webmentions_ssg/tasks/scanner.py @@ -406,7 +406,9 @@ def scan_sources() -> None: Scan generated source documents and queue pending Webmentions. New and changed sources are persisted, missing sources are marked as deleted, - and Webmentions requiring processing are queued for sending. + and Webmentions requiring processing are queued for sending. A scan that + successfully processes no sources is treated as inconclusive: it neither + marks sources deleted nor queues Webmentions. :raises RuntimeError: If the configured source directory or base URL is invalid. @@ -498,6 +500,17 @@ def scan_sources() -> None: except SourceScanError as exc: current_app.logger.warning("Could not scan source %s: %s", index_path, exc) + # A static-site generator can temporarily empty its output directory while + # rebuilding. With no successfully scanned pages, absence is not evidence + # of deletion; do not generate removals or send pending Webmentions that + # might be verified while the site is unavailable. + if scanned_count == 0: + current_app.logger.warning( + "No source documents successfully scanned; " + "skipping deletion detection and Webmention sends" + ) + return + for path, source in sources_by_path.items(): if source.deleted_at is not None or path in seen_paths: continue |
