diff --git a/backend/src/handlers/mod.rs b/backend/src/handlers/mod.rs index 2a6396f..eeb79f9 100644 --- a/backend/src/handlers/mod.rs +++ b/backend/src/handlers/mod.rs @@ -595,12 +595,20 @@ pub async fn set_global_limit_handler( ) -> impl IntoResponse { let client = xmlrpc::RtorrentClient::new(&state.scgi_socket_path); + // Switch to using set_kb which is often more reliable or the standard way for limits + if let Some(down) = payload.max_download_rate { - // Here is the fix: Send as Int + let down_kb = down / 1024; if let Err(e) = client - .call("throttle.global_down.max_rate.set", &[RpcParam::Int(down)]) + .call( + "throttle.global_down.max_rate.set_kb", + &[RpcParam::Int(down_kb)], + ) .await { + // Fallback or error? + // Maybe log and ignore? + // Let's assume set_kb works if set didn't (or vice versa). return ( StatusCode::INTERNAL_SERVER_ERROR, format!("Failed to set down limit: {}", e), @@ -610,8 +618,12 @@ pub async fn set_global_limit_handler( } if let Some(up) = payload.max_upload_rate { + let up_kb = up / 1024; if let Err(e) = client - .call("throttle.global_up.max_rate.set", &[RpcParam::Int(up)]) + .call( + "throttle.global_up.max_rate.set_kb", + &[RpcParam::Int(up_kb)], + ) .await { return (