Skip to content

Commit 6416506

Browse files
committed
fix: replace interval with sleep for status updates
1 parent f7cbf44 commit 6416506

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

src/handler/course.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,9 +267,8 @@ pub async fn stream_user_course_status(
267267

268268
// Spawn a background task to fetch and send status updates.
269269
tokio::spawn(async move {
270-
let mut interval = tokio::time::interval(std::time::Duration::from_secs(60));
271270
loop {
272-
interval.tick().await;
271+
tokio::time::sleep(std::time::Duration::from_secs(60)).await;
273272
let status = CourseService::get_user_course(ctx.clone(), &claims.id, &slug).await;
274273
if let Ok(status) = status {
275274
let event = Event::default().json_data(status).unwrap_or_else(|e| {

src/handler/stage.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,8 @@ pub async fn stream_user_stage_status(
231231

232232
// Spawn a background task to fetch and send status updates.
233233
tokio::spawn(async move {
234-
let mut interval = tokio::time::interval(std::time::Duration::from_secs(2 * 60));
235234
loop {
236-
interval.tick().await;
235+
tokio::time::sleep(std::time::Duration::from_secs(60)).await;
237236
let status =
238237
StageService::get_user_stage_status(&ctx, &claims.id, &slug, &stage_slug).await;
239238
if let Ok(status) = status {

0 commit comments

Comments
 (0)