Skip to content

Commit ed523cf

Browse files
authored
Introduce a delay between scheduled jobs (#273)
Signed-off-by: Sergio Castaño Arteaga <[email protected]>
1 parent 5a88065 commit ed523cf

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

clowarden-server/src/jobs.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ use clowarden_core::{
2020
use futures::future::{self, JoinAll};
2121
use octorust::types::{ChecksCreateRequestConclusion, JobStatus, PullRequestData};
2222
use serde::{Deserialize, Serialize};
23-
use std::{collections::HashMap, sync::Arc};
23+
use std::{collections::HashMap, sync::Arc, time::Duration};
2424
use tokio::{
2525
sync::{broadcast, mpsc},
2626
task::JoinHandle,
27-
time::{self, MissedTickBehavior},
27+
time::{self, sleep, MissedTickBehavior},
2828
};
2929
use tracing::{debug, error, instrument};
3030

@@ -377,6 +377,9 @@ pub(crate) fn scheduler(
377377
org: org.clone(),
378378
..Default::default()
379379
}));
380+
381+
// Introduce a delay between scheduled jobs
382+
sleep(Duration::from_secs(30)).await;
380383
}
381384
},
382385
}

0 commit comments

Comments
 (0)