Refactor web push notification handling to use reqwest client and improve session cleanup logic
Some checks failed
CI / ci (push) Failing after 1m44s

This commit is contained in:
2026-08-26 09:48:05 +02:00
parent 7aa5d692dc
commit a557c183e9
5 changed files with 157 additions and 296 deletions

View File

@@ -31,6 +31,8 @@ async fn run() -> Result<(), Box<dyn std::error::Error>> {
tracing::info!("push notifications enabled, reminder scheduler started");
}
spawn_session_cleanup(context.state.refresh_session_command.clone());
let router = http_axum::router::build_router(context.state);
let addr = format!("{}:{}", config.server.host, config.server.port);
@@ -75,6 +77,25 @@ fn spawn_reminder_scheduler(
});
}
fn spawn_session_cleanup(
refresh_session_command: std::sync::Arc<dyn domain::ports::RefreshSessionCommandPort>,
) {
tokio::spawn(async move {
let mut interval = tokio::time::interval(std::time::Duration::from_secs(3600));
loop {
interval.tick().await;
match refresh_session_command.delete_expired().await {
Ok(deleted) => {
if deleted > 0 {
tracing::info!(deleted, "expired refresh sessions cleaned up");
}
}
Err(e) => tracing::error!(error = %e, "refresh session cleanup failed"),
}
}
});
}
async fn shutdown_signal() {
let ctrl_c = async {
tokio::signal::ctrl_c()