prefactor: extract poll() function from start() #3

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

Parent

Part of #1

What to build

Extract the inner fetch-and-publish sweep from start() into a standalone async function poll() that accepts the HTTP session, Kafka stream engine, API settings, Kafka settings, and tracer as parameters, and returns the total number of Flights published.

start() is updated to call poll() exactly once — observable behaviour is unchanged. No tests are added in this ticket. The goal is purely to create the seam that tickets 3 and 4 depend on.

Acceptance criteria

  • A function poll() exists in main.py with the signature async def poll(session, stream_engine, api_settings, kafka_settings, tracer) -> int
  • poll() contains all pagination logic (following link: rel="next" headers) and all Kafka publish logic from the original start() sweep
  • poll() returns the total number of Flights published in that sweep
  • start() calls poll() once and the end-to-end producer behaviour is unchanged
  • Ruff linting passes with no new violations

Blocked by

None — can start immediately.

## Parent Part of #1 ## What to build Extract the inner fetch-and-publish sweep from `start()` into a standalone async function `poll()` that accepts the HTTP session, Kafka stream engine, API settings, Kafka settings, and tracer as parameters, and returns the total number of Flights published. `start()` is updated to call `poll()` exactly once — observable behaviour is unchanged. No tests are added in this ticket. The goal is purely to create the seam that tickets 3 and 4 depend on. ## Acceptance criteria - [ ] A function `poll()` exists in `main.py` with the signature `async def poll(session, stream_engine, api_settings, kafka_settings, tracer) -> int` - [ ] `poll()` contains all pagination logic (following `link: rel="next"` headers) and all Kafka publish logic from the original `start()` sweep - [ ] `poll()` returns the total number of Flights published in that sweep - [ ] `start()` calls `poll()` once and the end-to-end producer behaviour is unchanged - [ ] Ruff linting passes with no new violations ## Blocked by None — can start immediately.
peter added the
ready-for-agent
label 2026-07-19 08:45:56 +02:00
peter added spent time 2026-07-19 08:48:11 +02:00
1 second
peter self-assigned this 2026-07-19 08:48:11 +02:00
peter closed this issue 2026-07-19 09:03:21 +02:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Total Time Spent: 1 second
peter
1 second
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#3
No description provided.