PoC: hooks with APScheduler¶
Part of the architecture question owned by Ethaniel: how does the server detect an Action
(a hook) without a client being open, without treating the same event twice?
This PoC and pocs/hooks-celery/ reach the same target, so the two can be compared.
- Author: Ethaniel
- Date:
- Timebox: 1 hour
- Why this timebox: more than the 30-minute backend spikes, because the target adds a database and a scheduler; the same duration as the Celery PoC so the two results can be compared.
- Time actually spent:
- Stack: FastAPI, APScheduler, SQLite
Target¶
- Every N seconds, poll the issues of a public GitHub test repository:
GET https://api.github.com/repos/<owner>/<repo>/issues(no OAuth, 60 requests per hour) - For every new issue, print exactly once:
REAction: new issue #<n> <title> - No duplicate, even after a restart: issues already seen are stored in a SQLite file
- The interval is read from the
POLL_INTERVALenvironment variable, not a literal in the source - Use
ETag/If-None-Matchso unchanged answers come back as304(bonus) - Run it with Docker Compose (bonus)
Where I was when the time ran out¶
What took the most time¶
What it would take to go further¶
Running the PoC¶
Evidence¶
How the target was checked: create an issue, see the REAction once, restart, see no duplicate.
Impressions¶
What felt good, what got in the way, and what it suggests for AREA hooks (several server instances, failures, scheduling, Docker).