feat: implement continuous polling loop #5

Closed
opened 2026-07-19 08:46:25 +02:00 by peter · 0 comments
Owner

Parent

Part of #1

What to build

Make the producer run indefinitely. After the one-time startup (OTel initialisation, Kafka engine start, HTTP session creation), start() enters an infinite loop: it calls poll(), logs the number of Flights published, sleeps for 5 minutes, then calls poll() again.

Two additional behaviours:

  • OTel span per Poll: each call to poll() is wrapped in a poll_cycle span carrying a flights.published integer attribute equal to the return value of poll().
  • Transient error handling: if poll() raises an exception (e.g. a transient HTTP error from the Schiphol API), the loop logs the error and continues to the next cycle rather than crashing the process.

Graceful shutdown on SIGTERM/SIGINT is already handled by aiorun; no changes are needed there.

Acceptance criteria

  • The producer does not exit after a single Poll; it loops and executes a new Poll every 5 minutes
  • Each Poll cycle is wrapped in a poll_cycle OTel span with a flights.published attribute
  • A transient Poll failure (exception from poll()) is logged and the loop continues; the process does not crash
  • The producer shuts down cleanly on SIGTERM/SIGINT (existing aiorun behaviour preserved)
  • All tests from #4 remain green
  • Ruff linting passes

Blocked by

  • #4 (test: add pytest infrastructure and poll() tests)
## Parent Part of #1 ## What to build Make the producer run indefinitely. After the one-time startup (OTel initialisation, Kafka engine start, HTTP session creation), `start()` enters an infinite loop: it calls `poll()`, logs the number of Flights published, sleeps for 5 minutes, then calls `poll()` again. Two additional behaviours: - **OTel span per Poll**: each call to `poll()` is wrapped in a `poll_cycle` span carrying a `flights.published` integer attribute equal to the return value of `poll()`. - **Transient error handling**: if `poll()` raises an exception (e.g. a transient HTTP error from the Schiphol API), the loop logs the error and continues to the next cycle rather than crashing the process. Graceful shutdown on SIGTERM/SIGINT is already handled by `aiorun`; no changes are needed there. ## Acceptance criteria - [ ] The producer does not exit after a single Poll; it loops and executes a new Poll every 5 minutes - [ ] Each Poll cycle is wrapped in a `poll_cycle` OTel span with a `flights.published` attribute - [ ] A transient Poll failure (exception from `poll()`) is logged and the loop continues; the process does not crash - [ ] The producer shuts down cleanly on SIGTERM/SIGINT (existing `aiorun` behaviour preserved) - [ ] All tests from #4 remain green - [ ] Ruff linting passes ## Blocked by - #4 (test: add pytest infrastructure and poll() tests)
peter added the
ready-for-agent
label 2026-07-19 08:46:25 +02:00
peter self-assigned this 2026-07-19 09:07:41 +02:00
peter closed this issue 2026-07-19 09:11:16 +02:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: peter/schiphol#5
No description provided.