summaryrefslogtreecommitdiff
path: root/makima/src/server/state.rs
diff options
context:
space:
mode:
Diffstat (limited to 'makima/src/server/state.rs')
-rw-r--r--makima/src/server/state.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/makima/src/server/state.rs b/makima/src/server/state.rs
index 1f7b264..6bd9e2b 100644
--- a/makima/src/server/state.rs
+++ b/makima/src/server/state.rs
@@ -683,6 +683,11 @@ pub struct AppState {
pub tts_engine: OnceCell<Box<dyn TtsEngine>>,
/// Daemon reauth status storage (keyed by (daemon_id, request_id))
pub daemon_reauth_status: DashMap<(Uuid, Uuid), DaemonReauthStatus>,
+ /// Signal used to nudge the directive reconciler to run a tick immediately
+ /// (e.g. after a goal update) rather than waiting up to 15s for the next
+ /// interval. The reconciler loop in `server::mod` awaits `notified()` in
+ /// parallel with its interval; handlers call `kick_directive_reconciler()`.
+ pub directive_kick: std::sync::Arc<tokio::sync::Notify>,
}
impl AppState {
@@ -765,9 +770,16 @@ impl AppState {
pending_worktree_commit: DashMap::new(),
tts_engine: OnceCell::new(),
daemon_reauth_status: DashMap::new(),
+ directive_kick: std::sync::Arc::new(tokio::sync::Notify::new()),
}
}
+ /// Wake the directive reconciler so it ticks now instead of waiting for
+ /// the next 15-second interval. Cheap and safe to call from any handler.
+ pub fn kick_directive_reconciler(&self) {
+ self.directive_kick.notify_one();
+ }
+
/// Get or initialize the TTS engine (lazy loading).
///
/// The TTS engine is loaded on first Speak connection using the Chatterbox backend.