Skip to content

Commit

Permalink
change: move const val
Browse files Browse the repository at this point in the history
  • Loading branch information
Pugma committed Oct 4, 2024
1 parent c50922a commit 177ff50
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions server/app/src/traq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use crate::repo::Repository;

pub mod message;
pub const MESSAGE_LIMIT: i32 = 100;
const POLLING_INTERVAL_SEC: u64 = 180;

static CONFIG: LazyLock<Configuration> = LazyLock::new(|| Configuration {
bearer_access_token: Some(
Expand All @@ -19,10 +20,11 @@ static CONFIG: LazyLock<Configuration> = LazyLock::new(|| Configuration {

pub async fn start_polling(repo: Repository) -> Result<()> {
tokio::spawn(async move {
// run polling every 3 minutes
let mut interval = time::interval(Duration::new(180, 0));
// run polling at even intervals
let mut interval = time::interval(Duration::new(POLLING_INTERVAL_SEC, 0));
interval.tick().await;

// get last timestamp when this app restarts
let mut last_checkpoint = if let Ok(point) = repo.get_time().await {
point
} else {
Expand Down

0 comments on commit 177ff50

Please sign in to comment.