Watch
0
0
Fork
You've already forked hyperhive
0

docs: notification flows, their API and the notifications page

This commit is contained in:
atlas 2026-10-24 04:05:05 +02:00 • committed by mara
commit 7795da44f8
9 changed files with 140 additions and 59 deletions

View file

@ -18,9 +18,9 @@
use std::time::{Duration, Instant};
use async_nats::jetstream::ErrorCode;
use async_nats::jetstream::context::GetStreamErrorKind;
use async_nats::jetstream::{self, kv};
use async_nats::jetstream::ErrorCode;
use swarm_wire::notify_flows::{self, Document, Flow};
/// How long a read of the key is reused.
@ -31,7 +31,10 @@ const REFRESH: Duration = Duration::from_secs(10);
pub enum Read {
/// No key, a deleted key, or no bucket.
Absent,
Document { revision: u64, bytes: Vec<u8> },
Document {
revision: u64,
bytes: Vec<u8>,
},
Failed(String),
}
@ -62,7 +65,9 @@ impl Flows {
Read::Failed(why) => self.note(format!("reading the key failed: {why}")),
Read::Absent => {
if self.revision.take().is_some() {
tracing::info!("notify router: the flows document is gone; running the built-in flows");
tracing::info!(
"notify router: the flows document is gone; running the built-in flows"
);
}
self.active = Document::default().active().0;
self.problem = None;