feature/configv2
prplV 2025-04-18 08:44:16 -04:00
parent e3f07f42a6
commit 4fc90300fc
1 changed files with 4 additions and 5 deletions

View File

@ -19,8 +19,6 @@ pub mod v2 {
// type EventHandlers<'a> = HashMap<service name, sender object>
type EventHandlers<'a> = HashMap<&'a str, (Triggers<'a>, MpscSender<Events<'a>>)>;
//
type FileTriggersWrapper<'a> = HashMap<&'a str, Triggers<'a>>;
struct FilesController<'a> {
name: &'a str,
@ -54,12 +52,12 @@ pub mod v2 {
}
async fn trigger_on(&mut self, trigger_type: Option<FileTriggerType>) {
let _ = self.triggers.iter()
.map(|(_, (triggers, channel))| async {
.map(|(prc_name, (triggers, channel))| async {
let _ = channel.send({
match &trigger_type {
None => Events::Positive(self.name),
Some(event) => {
info!("Event on {} ({}) : {}", self.name, &self.path, event);
info!("Event on file {} ({}) : {}. Notifying `{}` ...", self.name, &self.path, event, *prc_name);
event.event_from_file_trigger_controller(self.name, triggers)
},
}
@ -95,6 +93,7 @@ pub mod v2 {
}
}
self.trigger_on(Some(FileTriggerType::OnChange)).await;
return;
}
}
},