Split syncer from web app #139

Closed
opened 2026-09-12 19:46:32 +00:00 by aniram · 1 comment
Owner

Right now the web app's main.go is polluted with flags for the syncer.
The syncer should be a separate project, maybe a module inside the web app or ideally have its own repository.
The models must be exported and utils like exponentialBackoff and currentLegislature too. CurrentLegislature and exponentialBackoff are needed in the chamber's poll parser also.

Right now the web app's main.go is polluted with flags for the syncer. The syncer should be a separate project, maybe a module inside the web app or ideally have its own repository. The models must be exported and utils like exponentialBackoff and currentLegislature too. CurrentLegislature and exponentialBackoff are needed in the chamber's poll parser also.
aniram added this to the 2027.1 milestone 2026-09-12 20:21:04 +00:00
aniram changed title from Split syncer from the web app to Split syncer from web app 2026-10-07 10:48:24 +00:00
Author
Owner

Migration path

  1. Move current main.go to cmd/web/main.go (strip the sync code).
  2. Create cmd/syncer/ and move the flag logic there, converting one flag at a time into a command.
  3. Update your Dockerfile/Makefile/CI to build both binaries.
  4. Update whatever invokes the syncer (cron, systemd, scripts) from ./app -syncPolls -year=2024 to ./syncer polls --year=2024.

TODOs

Migration path 1. Move current main.go to cmd/web/main.go (strip the sync code). 2. Create cmd/syncer/ and move the flag logic there, converting one flag at a time into a command. 3. Update your Dockerfile/Makefile/CI to build both binaries. 4. Update whatever invokes the syncer (cron, systemd, scripts) from ./app -syncPolls -year=2024 to ./syncer polls --year=2024. TODOs - [x] Extract Config into internal/config (overdrives/chambersbr#157) - [x] Move the web server into cmd/web and remove all sync code from it (overdrives/chambersbr#158) - [x] Move template FuncMap and date helpers out of main into a dedicated package (overdrives/chambersbr#159) - [x] Extract route registration and dependency wiring into internal/server (overdrives/chambersbr#160) - [x] Use http.Server with timeouts, handle ListenAndServe errors, and shut down gracefully (overdrives/chambersbr#161) - [x] Create cmd/syncer entrypoint with a single shared setup (DB, log file, logger, syncer) (overdrives/chambersbr#162) - [x] Implement the subcommand dispatcher (overdrives/chambersbr#163) - [x] Port sync commands to the new CLI, grouped by domain (overdrives/chambersbr#164) - [x] Make sync failures return a non-zero exit code (overdrives/chambersbr#165) - [x] Pass context.Context through syncer methods and HTTP calls to government APIs (overdrives/chambersbr#166) - [x] Update scripts and cron/systemd to use the two binaries and the new syncer commands (overdrives/chambersbr#167) - [ ] Add tests for syncer command parsing and dispatch (overdrives/chambersbr#168)
aniram added reference feat/split-syncer-from-main-app 2026-10-12 15:38:35 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
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
overdrives/chambersbr#139
No description provided.