fix: Run control on Data Flow now starts the live data generator
Previously Run/Pause/Stop only drove the pulse animation, so on the Data Flow tab nothing was generated (the streamer is heartbeat-gated and only the Live dashboard was sending heartbeats). Now: - New POST /api/federated/live/heartbeat keep-alive endpoint. - Run seeds an immediate burst into the sources and keeps the generator alive (5s heartbeat) while the tab is open; Pause/Stop halts generation.
This commit is contained in:
@@ -622,6 +622,19 @@ async def toggle_generator(body: dict = Body(default={})):
|
||||
return {"ok": True, "enabled": _GEN["enabled"], "interval": _GEN["interval"], "running": _GEN["running"]}
|
||||
|
||||
|
||||
@router.post("/live/heartbeat")
|
||||
async def live_heartbeat(body: dict = Body(default={})):
|
||||
"""Keep-alive for the continuous generator from any watching view (e.g. the
|
||||
Data Flow tab's Run control). active=true → generate; active=false → stop."""
|
||||
active = bool(body.get("active", True))
|
||||
if active:
|
||||
_GEN["enabled"] = True
|
||||
_GEN["last_seen"] = time.time()
|
||||
else:
|
||||
_GEN["last_seen"] = 0.0
|
||||
return {"ok": True, "running": _GEN["running"], "enabled": _GEN["enabled"]}
|
||||
|
||||
|
||||
@router.post("/generate")
|
||||
async def generate_now(body: dict = Body(default={})):
|
||||
"""Manual one-shot burst into the source systems (the Data Flow "Generate
|
||||
|
||||
Reference in New Issue
Block a user