Spaces:
Sleeping
Sleeping
Download backend/timing.py from Success-dev/receipter-pro: direct link, hf CLI and curl.
- Browser
- Download file 674 Bytes
-
https://huggingface.co/spaces/Success-dev/receipter-pro/resolve/main/backend/timing.py
- Command line
-
hf download hf://spaces/Success-dev/receipter-pro/backend/timing.py
-
curl -L -o timing.py https://huggingface.co/spaces/Success-dev/receipter-pro/resolve/main/backend/timing.py
674 Bytes
| """ | |
| Everything that happens "when its time comes", run from one place so a single timer drives it: | |
| queued and scheduled sends, and automations (sequences, recurring and date-based sends). | |
| See docs/blueprint/adr/0004. | |
| """ | |
| from __future__ import annotations | |
| from datetime import datetime | |
| from backend import automations, delivery, sending | |
| def run_due(now: datetime | None = None, budget_seconds: float = 240) -> dict: | |
| # Automations first, so the campaigns they make are picked up in the same pass. | |
| made = automations.run_due(now) | |
| sends = sending.run_due(now, budget_seconds) | |
| return {"automations": made, "sends": sends, "delivery": delivery.run_due(now)} | |