Skip to content

Commit

Permalink
remove unnecessary thread spawning
Browse files Browse the repository at this point in the history
  • Loading branch information
Pugma committed Oct 3, 2024
1 parent af30ef5 commit 1ae0007
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions server/app/src/traq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,15 @@ static CONFIG: LazyLock<Configuration> = LazyLock::new(|| Configuration {

pub async fn start_polling(repo: Repository) -> Result<()> {
tokio::spawn(async move {
// 3 分おきに実行
// run polling every 3 minutes
let mut interval = time::interval(Duration::new(180, 0));
interval.tick().await;

loop {
interval.tick().await;

let repo = repo.clone();
tokio::spawn(async move {
info!("start polling ...");
let _ = message::collect(&repo, &CONFIG).await;
});
info!("start polling ...");
let _ = message::collect(&repo, &CONFIG).await;
}
})
.await?;
Expand Down

0 comments on commit 1ae0007

Please sign in to comment.