fix: reduce heartbeat frequency

This commit is contained in:
2026-08-28 17:15:25 +02:00
parent 489ba448b3
commit c3a266e7a5
5 changed files with 11 additions and 10 deletions
Generated
+1 -1
View File
@@ -136,7 +136,7 @@ dependencies = [
[[package]]
name = "basango"
version = "0.2.0"
version = "0.2.1"
dependencies = [
"anyhow",
"bullmq-official",
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "basango"
version = "0.2.0"
version = "0.2.1"
edition = "2024"
rust-version = "1.85"
description = "A Rust-native Basango news crawler with HTML and WordPress adapters"
+3 -6
View File
@@ -4,10 +4,7 @@ use std::time::Duration as StdDuration;
use std::time::Instant;
use chrono::Duration;
use tokio::{
sync::oneshot,
time::{Duration as TokioDuration, interval},
};
use tokio::{sync::oneshot, time::interval};
use uuid::Uuid;
use crate::{
@@ -16,7 +13,7 @@ use crate::{
error::{CrawlError, Result},
execution::Runtime,
sources::SourceAdapter,
telemetry::{RunMetrics, RunReporter},
telemetry::{HEARTBEAT_INTERVAL, RunMetrics, RunReporter},
};
#[derive(Debug, Clone, Default, PartialEq, Eq)]
@@ -38,7 +35,7 @@ pub async fn crawl_now(runtime: &Runtime, mut request: CrawlRequest) -> Result<C
);
let heartbeat_reporter = reporter.clone();
let heartbeat_task = tokio::spawn(async move {
let mut ticker = interval(TokioDuration::from_secs(15));
let mut ticker = interval(HEARTBEAT_INTERVAL);
loop {
ticker.tick().await;
heartbeat_reporter.heartbeat().await;
+2 -2
View File
@@ -16,7 +16,7 @@ use crate::{
error::{CrawlError, Result},
execution::{DeliveryJob, DiscoverJob, FetchJob, JobQueue, QueuedArticleResult, Runtime},
sources::SourceAdapter,
telemetry::{AgentReporter, RunReporter},
telemetry::{AgentReporter, HEARTBEAT_INTERVAL, RunReporter},
};
use delivery::{enqueue_delivery_intent, process_delivery, reconcile_delivery_intents};
@@ -86,7 +86,7 @@ pub async fn run_worker(
&runtime.agent_id,
);
let heartbeat_task = tokio::spawn(async move {
let mut ticker = interval(Duration::from_secs(15));
let mut ticker = interval(HEARTBEAT_INTERVAL);
loop {
ticker.tick().await;
heartbeat_reporter.heartbeat().await;
+4
View File
@@ -6,5 +6,9 @@
mod reporter;
mod signal;
use std::time::Duration;
pub(crate) use reporter::{AgentReporter, RunReporter, agent_id};
pub(crate) use signal::RunMetrics;
pub(crate) const HEARTBEAT_INTERVAL: Duration = Duration::from_secs(60);