fix: resolve borrow-after-move error in notification handler
All checks were successful
Build MIPS Binary / build (push) Successful in 1m54s
All checks were successful
Build MIPS Binary / build (push) Successful in 1m54s
This commit is contained in:
@@ -18,13 +18,13 @@ pub async fn torrent_finished_handler(
|
|||||||
) -> StatusCode {
|
) -> StatusCode {
|
||||||
tracing::info!("WEBHOOK: Received notification from rTorrent. Name: {:?}, Hash: {:?}", params.name, params.hash);
|
tracing::info!("WEBHOOK: Received notification from rTorrent. Name: {:?}, Hash: {:?}", params.name, params.hash);
|
||||||
|
|
||||||
let name = if params.name.is_empty() || params.name == "$d.name=" {
|
let torrent_name = if params.name.is_empty() || params.name == "$d.name=" {
|
||||||
"Bilinmeyen Torrent".to_string()
|
"Bilinmeyen Torrent".to_string()
|
||||||
} else {
|
} else {
|
||||||
params.name
|
params.name.clone()
|
||||||
};
|
};
|
||||||
|
|
||||||
let message = format!("Torrent tamamlandı: {}", name);
|
let message = format!("Torrent tamamlandı: {}", torrent_name);
|
||||||
|
|
||||||
// 1. Send to active SSE clients (for Toast)
|
// 1. Send to active SSE clients (for Toast)
|
||||||
let notification = SystemNotification {
|
let notification = SystemNotification {
|
||||||
@@ -39,13 +39,13 @@ pub async fn torrent_finished_handler(
|
|||||||
let push_store = state.push_store.clone();
|
let push_store = state.push_store.clone();
|
||||||
let title = "Torrent Tamamlandı".to_string();
|
let title = "Torrent Tamamlandı".to_string();
|
||||||
let body = message;
|
let body = message;
|
||||||
let torrent_name = params.name.clone();
|
let name_for_log = torrent_name.clone();
|
||||||
|
|
||||||
tokio::spawn(async move {
|
tokio::spawn(async move {
|
||||||
tracing::info!("Attempting to send Web Push notification for torrent: {}", torrent_name);
|
tracing::info!("Attempting to send Web Push notification for torrent: {}", name_for_log);
|
||||||
match crate::push::send_push_notification(&push_store, &title, &body).await {
|
match crate::push::send_push_notification(&push_store, &title, &body).await {
|
||||||
Ok(_) => tracing::info!("Web Push notification sent successfully for: {}", torrent_name),
|
Ok(_) => tracing::info!("Web Push notification task completed for: {}", name_for_log),
|
||||||
Err(e) => tracing::error!("Failed to send Web Push notification for {}: {:?}", torrent_name, e),
|
Err(e) => tracing::error!("Failed to send Web Push notification for {}: {:?}", name_for_log, e),
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user