Skip to content

Commit

Permalink
feat: run immediadly
Browse files Browse the repository at this point in the history
  • Loading branch information
kjuulh committed Mar 7, 2023
1 parent e055fc4 commit 6193de8
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions crates/gitevents_sdk/src/cron.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,25 @@ impl CronExecutor {

let (tx, mut rx) = tokio::sync::broadcast::channel::<GitEvent>(2);

let mut clone_js: JoinSet<eyre::Result<()>> = JoinSet::new();

for provider in git_providers.clone() {
let tx = tx.clone();

clone_js.spawn(async move {
tracing::trace!("syncing git_provider");
if let Some(event) = provider.lock().await.listen().await? {
tx.send(event).unwrap();
}

Ok(())
});
}

while let Some(task) = clone_js.join_next().await {
task.unwrap().unwrap();
}

let job = Job::new_repeated_async(self.opts.duration, move |uuid, _l| {
let git_providers = git_providers.clone();
let tx = tx.clone();
Expand Down

0 comments on commit 6193de8

Please sign in to comment.