Release v0.6.0
Rust CI / Test & Quality Checks (push) Canceled after 0s
Rust CI / Build Docker Image (push) Canceled after 0s

This commit is contained in:
thakares committed 2026-08-09 17:17:57 +05:30
1 parent 7069ca9db7
commit f49698bb5c
75 files changed
+11199 -7508

No files matched your search

+8 -4
View File
@@ -8,15 +8,19 @@ pub struct AnalyticsQueue {
}
impl AnalyticsQueue {
pub fn new(db: Db, capacity: usize) -> Self {
pub fn new(
db: Db,
capacity: usize,
shutdown_rx: tokio::sync::watch::Receiver<bool>,
) -> (Self, tokio::task::JoinHandle<()>) {
let (sender, receiver) = mpsc::channel(capacity);
// Spawn background worker to batch-write records
tokio::spawn(async move {
super::worker::run_worker(db, receiver).await;
let handle = tokio::spawn(async move {
super::worker::run_worker(db, receiver, shutdown_rx).await;
});
Self { sender }
(Self { sender }, handle)
}
// Attempt to queue a visit. Non-blocking.