Skip to content

feat: async filesystem resync with progress polling#1216

Merged
perber merged 1 commit into
mainfrom
feat/async-resync-with-progress
Jun 26, 2026
Merged

feat: async filesystem resync with progress polling#1216
perber merged 1 commit into
mainfrom
feat/async-resync-with-progress

Conversation

@perber

@perber perber commented Jun 26, 2026

Copy link
Copy Markdown
Owner

Adds a non-blocking POST /api/admin/resync endpoint that starts a background reload and returns 202 immediately. Clients poll GET /api/admin/resync/status (running/phase/done/error) until the job completes. The UI shows a live phase-progress banner.

Backend:

  • internal/wiki/resync/job.go: ResyncJob state machine (tree→links→tags→search)
  • internal/wiki/resync/use_cases.go: TriggerResyncUseCase + GetResyncStatusUseCase
  • internal/wiki/resync/errors.go: LocalizedError codes + HTTP mapper
  • wiki.go: reloadWithProgress (context-aware, shutdown-cancellable via shutdownCtx), initSearch goroutine tracked in reloadWG, Close() cancels context before Wait()
  • cmd/leafwiki/main.go: signal handler uses TriggerResyncAsync (fire-and-forget)

Frontend:

  • stores/resync.ts: polling loop with consecutive-error circuit breaker; !running without done=true throws 'job lost' instead of silent success
  • MaintenanceSettings.tsx: phase progress banner, ApiLocalizedError handling
  • locales/en/maintenance.json + errors.json: i18n keys for all new states

@perber
perber force-pushed the feat/async-resync-with-progress branch from d54aa5c to c2b9037 Compare June 26, 2026 20:40
Adds a non-blocking POST /api/admin/resync endpoint that starts a
background reload and returns 202 immediately. Clients poll
GET /api/admin/resync/status (running/phase/done/error) until the
job completes. The UI shows a live phase-progress banner.

Backend:
- internal/wiki/resync/job.go: ResyncJob state machine (tree→links→tags→search)
- internal/wiki/resync/use_cases.go: TriggerResyncUseCase + GetResyncStatusUseCase
- internal/wiki/resync/errors.go: LocalizedError codes + HTTP mapper
- wiki.go: reloadWithProgress (context-aware, shutdown-cancellable via shutdownCtx),
  initSearch goroutine tracked in reloadWG, Close() cancels context before Wait()
- cmd/leafwiki/main.go: signal handler uses TriggerResyncAsync (fire-and-forget)

Frontend:
- stores/resync.ts: polling loop with consecutive-error circuit breaker;
  !running without done=true throws 'job lost' instead of silent success
- MaintenanceSettings.tsx: phase progress banner, ApiLocalizedError handling
- locales/en/maintenance.json + errors.json: i18n keys for all new states
@perber
perber force-pushed the feat/async-resync-with-progress branch from c2b9037 to eaf9bf4 Compare June 26, 2026 20:48
@perber
perber merged commit 8e07e06 into main Jun 26, 2026
9 checks passed
@perber
perber deleted the feat/async-resync-with-progress branch June 26, 2026 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant