docs: notification flows, their API and the notifications page
This commit is contained in:
parent
0512862b3d
commit
7795da44f8
9 changed files with 140 additions and 59 deletions
|
|
@ -124,7 +124,6 @@ pub fn expand(template: &str, fields: &Fields) -> String {
|
|||
out
|
||||
}
|
||||
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use swarm_wire::notify_flows::{Edge, builtins};
|
||||
|
|
@ -230,14 +229,7 @@ mod tests {
|
|||
assert_eq!(a.op.key, "forge:hyperhive/hyperhive#7:");
|
||||
assert_eq!(a.op.summary, "");
|
||||
}
|
||||
assert!(
|
||||
evaluate(
|
||||
&closed,
|
||||
"issues",
|
||||
&event("reopened", &[], &[], &["atlas"])
|
||||
)
|
||||
.is_empty()
|
||||
);
|
||||
assert!(evaluate(&closed, "issues", &event("reopened", &[], &[], &["atlas"])).is_empty());
|
||||
}
|
||||
|
||||
/// A match node with two children runs both: the branching the tree
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue