Skip to content

Refactor: sync/watch lifecycle via SyncCoordinator #497

Description

@phernandez

Refactor: sync/watch lifecycle via SyncCoordinator

Why

Background sync + watch lifecycle is a cross-cutting concern that can easily leak into initialization, routers, and MCP lifespan. Centralizing lifecycle improves reliability and reduces coupling.

Scope

  • Introduce a SyncCoordinator responsible for:
    • starting/stopping watch service
    • scheduling background sync
    • reporting status
  • Entrypoints decide when to start it (API/MCP/CLI) via their containers.

Acceptance criteria

  • Lifecycle logic centralized in one place.
  • Fewer scattered background-task conditionals.
  • Stable shutdown behavior (especially in Postgres test mode where hangs were previously noted).

Dependencies

  • After containers + deps split.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions