Summary
src/openhuman/webhooks/router.rs — the persist() method calls std::fs::write synchronously, which blocks the tokio worker thread if called from an async context. This happens on every register / unregister call.
Impact
Low-Medium — Under rapid webhook registration churn, this can stall the tokio worker thread and cause latency spikes for other concurrent tasks.
Suggested Fix
Use tokio::task::spawn_blocking for the persist operation:
let data = serde_json::to_string(&routes)?;
let path = self.persist_path.clone();
tokio::task::spawn_blocking(move || std::fs::write(&path, data)).await??;
Or debounce persistence with a short delay to batch rapid changes.
Summary
src/openhuman/webhooks/router.rs— thepersist()method callsstd::fs::writesynchronously, which blocks the tokio worker thread if called from an async context. This happens on everyregister/unregistercall.Impact
Low-Medium — Under rapid webhook registration churn, this can stall the tokio worker thread and cause latency spikes for other concurrent tasks.
Suggested Fix
Use
tokio::task::spawn_blockingfor the persist operation:Or debounce persistence with a short delay to batch rapid changes.