aboutsummaryrefslogtreecommitdiff
path: root/webmentions_ssg/tasks/scanner.py
diff options
context:
space:
mode:
authorDennis Fink2026-11-18 08:01:26 +0100
committerDennis Fink2026-11-18 08:01:26 +0100
commitb908ee61770dc78f8d8fbbbfc4f3c00d7877d42a (patch)
tree322d85654e5518c2836ce57beafaa7e2abaab741 /webmentions_ssg/tasks/scanner.py
parent63af533d98aac82b6d4f069b217d3e837285508d (diff)
downloadwebmentions-ssg-b908ee61770dc78f8d8fbbbfc4f3c00d7877d42a.tar.gz
webmentions-ssg-b908ee61770dc78f8d8fbbbfc4f3c00d7877d42a.zip
feat(core): add dashboard overview
Replace the root redirect with an authenticated dashboard showing received and outgoing status counts, recent activity, pending sends, retries, and queue depth. Persist the last completed source scan so operational status survives restarts and only advances after a successful, conclusive scan.
Diffstat (limited to 'webmentions_ssg/tasks/scanner.py')
-rw-r--r--webmentions_ssg/tasks/scanner.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/webmentions_ssg/tasks/scanner.py b/webmentions_ssg/tasks/scanner.py
index 1f98702..9058b9b 100644
--- a/webmentions_ssg/tasks/scanner.py
+++ b/webmentions_ssg/tasks/scanner.py
@@ -14,6 +14,7 @@ from huey.exceptions import RetryTask, TaskLockedException
from sqlalchemy.orm import selectinload
from ..extensions import db, huey
+from ..models.scan_state import ScanState
from ..models.sources import SentWebmention, SourceDocument
from ..net import is_http_url
from .sender import send_webmention
@@ -304,6 +305,11 @@ def _scan_and_enqueue() -> None:
db.session.commit()
pending_count = enqueue_due_sends(scan_time)
+ # Mark a scan complete only after reconciliation and task enqueueing have
+ # succeeded. An inconclusive or interrupted scan keeps the previous value.
+ db.session.merge(ScanState(id=1, last_completed_at=datetime.now(UTC)))
+ db.session.commit()
+
current_app.logger.info(
"Webmention source scan complete: %d sources scanned, "
"%d missing sources, %d pending sends",