[crawler]
This commit is contained in:
2
crawler_platform/app/core/scheduler/__init__.py
Normal file
2
crawler_platform/app/core/scheduler/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
||||
"""Scheduling primitives for recrawls."""
|
||||
|
||||
11
crawler_platform/app/core/scheduler/update_policy.py
Normal file
11
crawler_platform/app/core/scheduler/update_policy.py
Normal file
@@ -0,0 +1,11 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import datetime, timedelta, timezone
|
||||
|
||||
|
||||
def next_crawl_at(policy: dict[str, object] | None, now: datetime | None = None) -> datetime:
|
||||
now = now or datetime.now(timezone.utc)
|
||||
policy = policy or {}
|
||||
interval_days = int(policy.get("interval_days", 7))
|
||||
return now + timedelta(days=interval_days)
|
||||
|
||||
Reference in New Issue
Block a user