Skip to content

Commit

Permalink
Introduce a delay between scheduled jobs (#273)
Browse files Browse the repository at this point in the history
Signed-off-by: Sergio Castaño Arteaga <[email protected]>
  • Loading branch information
tegioz authored Oct 25, 2024
1 parent 5a88065 commit ed523cf
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions clowarden-server/src/jobs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ use clowarden_core::{
use futures::future::{self, JoinAll};
use octorust::types::{ChecksCreateRequestConclusion, JobStatus, PullRequestData};
use serde::{Deserialize, Serialize};
use std::{collections::HashMap, sync::Arc};
use std::{collections::HashMap, sync::Arc, time::Duration};
use tokio::{
sync::{broadcast, mpsc},
task::JoinHandle,
time::{self, MissedTickBehavior},
time::{self, sleep, MissedTickBehavior},
};
use tracing::{debug, error, instrument};

Expand Down Expand Up @@ -377,6 +377,9 @@ pub(crate) fn scheduler(
org: org.clone(),
..Default::default()
}));

// Introduce a delay between scheduled jobs
sleep(Duration::from_secs(30)).await;
}
},
}
Expand Down

0 comments on commit ed523cf

Please sign in to comment.