Skip to content
Snippets Groups Projects
Unverified Commit 434b64aa authored by Antoine R. Dumont's avatar Antoine R. Dumont
Browse files

scheduler/runner-first-visits: Log number of first visits scheduled

parent 7aa69718
No related branches found
No related tags found
No related merge requests found
......@@ -28,6 +28,7 @@ def schedule_first_visits(backend: SchedulerInterface):
from .utils import get_loader_task_type, send_to_celery
nb_first_visits = 0
for lister in backend.get_listers(with_first_visits_to_schedule=True):
visit_types = backend.get_visit_types_for_listed_origins(lister)
visit_type_to_queue = {}
......@@ -40,7 +41,7 @@ def schedule_first_visits(backend: SchedulerInterface):
f"{lister.first_visits_queue_prefix}:{task_type.backend_name}"
)
send_to_celery(
nb_first_visits += send_to_celery(
backend,
visit_type_to_queue=visit_type_to_queue,
policy="first_visits_after_listing",
......@@ -84,3 +85,5 @@ def schedule_first_visits(backend: SchedulerInterface):
)
lister.first_visits_scheduled_at = utcnow()
backend.update_lister(lister)
return nb_first_visits
......@@ -248,9 +248,10 @@ def runner_first_visits(ctx, period):
try:
while True:
logger.debug("Schedule first visits")
logger.debug("Schedule first visits...")
try:
schedule_first_visits(scheduler)
nb_first_visits = schedule_first_visits(scheduler)
logger.info("Scheduled %s first visits", nb_first_visits)
except ValueError:
logger.exception("Unexpected error in run_high_priority_first_visits()")
sentry_sdk.capture_exception()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment