Add admin sync hot reload path

This commit is contained in:
2026-06-19 01:54:13 +02:00
parent 6f68f8f9ec
commit 3e93567a53
9 changed files with 676 additions and 72 deletions

View File

@@ -116,7 +116,40 @@ asyncio.run(publish())
---
## Syncing schedules manually
## Syncing definitions and schedules manually
When the API is running, prefer the admin sync endpoint for definition or
schedule changes. It refreshes file-backed ActivityDefinitions and reconciles
Temporal Schedules without restarting the worker:
```bash
curl -s -X POST \
'http://localhost:8010/admin/sync?definitions=true&schedules=true'
```
The response reports:
- `definitions.synced`
- `event_types.synced`
- `schedules.upserted`
- `schedules.paused`
- `schedules.deleted_orphans`
- bounded `errors[]`
`event_types` defaults to `false` for this endpoint because event-triggered
definitions already reload from the DB in the event router path; opt in when
the operator intentionally changed event type definition files:
```bash
curl -s -X POST \
'http://localhost:8010/admin/sync?definitions=true&schedules=true&event_types=true'
```
The v1 posture is manual/operator-triggered sync. A periodic background loop is
deferred until live use shows it is needed; this keeps customer definition
changes explicit and avoids background repo scanning from the worker.
If the API is unavailable, the schedule-only CLI remains available:
```bash
TEMPORAL_HOST=localhost:7233 \
@@ -126,7 +159,7 @@ ACTCORE_DB_URL=postgresql+asyncpg://actcore:actcore@localhost:5433/actcore \
This reconciles all Temporal Schedules with the `activity_definitions` table:
- Upserts schedules for every enabled cron definition
- Creates paused schedules for disabled cron definitions
- Creates paused schedules for disabled cron or one-shot scheduled definitions
- Deletes orphaned schedules with no matching DB row
After adding or changing a recurring ActivityDefinition or workflow activity