aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.rs23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/main.rs b/src/main.rs
index 266e915..bc9a7b5 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -79,17 +79,18 @@ async fn main() -> anyhow::Result<()> {
match notification? {
Incoming(Packet::Publish(p)) => {
for (topic, programs) in conf.routes.iter() {
- if topic_match(&topic, &p.topic) {
- for program in programs {
- // TODO: Switch to moro_local to avoid this ewwyness
- let program = program.clone();
- let p = p.clone();
- tokio::spawn(async move {
- if let Err(e) = run(&program, &p).await {
- eprintln!("error: Failed to run {program:?}: {e:?}");
- }
- });
- }
+ if !topic_match(&topic, &p.topic) {
+ continue;
+ }
+ for program in programs {
+ // TODO: Switch to moro_local to avoid this ewwyness
+ let program = program.clone();
+ let p = p.clone();
+ tokio::spawn(async move {
+ if let Err(e) = run(&program, &p).await {
+ eprintln!("error: Failed to run {program:?}: {e:?}");
+ }
+ });
}
}
}