Implement event-driven daemon improvements for bd-85
- Add mutation events for label/dep/comment operations - Create separate export-only and import-only functions - Add dropped events counter with safety net export - Complete bd-80 mutation channel implementation Event-driven mode now: - Emits mutation events for ALL write operations (not just create/update/close) - Uses createExportFunc() for mutations (export+commit/push only, no pull) - Uses createAutoImportFunc() for file changes (pull+import only, no export) - Tracks dropped events and triggers safety export every 60s if any dropped - Achieves <500ms latency target by avoiding full sync on each trigger Behind BEADS_DAEMON_MODE=events flag (poll is still default)
This commit is contained in:
@@ -70,7 +70,7 @@ func runEventDrivenLoop(
|
||||
}
|
||||
}()
|
||||
|
||||
// Optional: Periodic health check (not a sync poll)
|
||||
// Optional: Periodic health check and dropped events safety net
|
||||
healthTicker := time.NewTicker(60 * time.Second)
|
||||
defer healthTicker.Stop()
|
||||
|
||||
@@ -79,6 +79,13 @@ func runEventDrivenLoop(
|
||||
case <-healthTicker.C:
|
||||
// Periodic health validation (not sync)
|
||||
checkDaemonHealth(ctx, store, log)
|
||||
|
||||
// Safety net: check for dropped mutation events
|
||||
dropped := server.ResetDroppedEventsCount()
|
||||
if dropped > 0 {
|
||||
log.log("WARNING: %d mutation events were dropped, triggering export", dropped)
|
||||
exportDebouncer.Trigger()
|
||||
}
|
||||
|
||||
case sig := <-sigChan:
|
||||
if isReloadSignal(sig) {
|
||||
|
||||
Reference in New Issue
Block a user