Add admin sync hot reload path
This commit is contained in:
parent
6f68f8f9ec
commit
3e93567a53
9 changed files with 676 additions and 72 deletions
|
|
@ -40,6 +40,7 @@ from temporalio.client import Client
|
|||
from activity_core.models import ActivityDefinition, CronTriggerConfig
|
||||
from activity_core.orm import ActivityDefinition as ActivityDefinitionRow, EventType as EventTypeRow
|
||||
from activity_core.schedule_manager import delete_schedule, upsert_schedule
|
||||
from activity_core.sync_service import run_sync
|
||||
from activity_core.webhook_receiver import router as webhook_router
|
||||
|
||||
TEMPORAL_HOST = os.environ.get("TEMPORAL_HOST", "localhost:7233")
|
||||
|
|
@ -275,6 +276,24 @@ async def trigger_definition(definition_id: uuid.UUID) -> dict[str, str]:
|
|||
return {"workflow_id": handle.id, "trigger_key": trigger_key}
|
||||
|
||||
|
||||
# --- Admin sync ---------------------------------------------------------------
|
||||
|
||||
@app.post("/admin/sync")
|
||||
async def admin_sync(
|
||||
definitions: bool = True,
|
||||
schedules: bool = True,
|
||||
event_types: bool = False,
|
||||
) -> dict[str, Any]:
|
||||
"""Run operator-triggered definition/event/schedule sync without restart."""
|
||||
return await run_sync(
|
||||
session_factory=_get_db(),
|
||||
temporal_client=_get_temporal() if schedules else None,
|
||||
definitions=definitions,
|
||||
schedules=schedules,
|
||||
event_types=event_types,
|
||||
)
|
||||
|
||||
|
||||
# T42: Curator gate — event type approval endpoint
|
||||
|
||||
@app.get("/health")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue