Fix Deluge connection keep-alive error; remove stale restart banner

- Use pool_max_idle_per_host(0) on reqwest Client so each Deluge JSON-RPC
  call gets a fresh TCP connection; Twisted HTTP closes keep-alive conns
  aggressively causing "connection closed before message completed" errors
- Remove always-visible restart banner from Settings page; the old
  condition (settings_count > 0) was permanently true after any save
- Drop unused HashMap import in deluge.rs
- Update dev config: Deluge enabled with labels=[], dev password set
This commit is contained in:
2026-05-19 21:55:28 -07:00
parent 6cb9428567
commit e5451bbe83
4 changed files with 33 additions and 23 deletions
+24 -9
View File
@@ -14,14 +14,21 @@ relays:
- "wss://nos.lol"
- "wss://freelay.sovbit.dev"
- "wss://freelay.sovbit.host"
- "wss://relay.primal.net"
- "wss://relay.snort.social"
- "wss://nostr.mom"
- "wss://relay.nostr.band"
- "wss://nostr.wine"
- "wss://relay.nos.social"
- "wss://wot.nostr.net"
backfill_days: 7
backfill_days: 365
negentropy_bootstrap: false
curation:
wot_only: false
follow_depth: 2
operator_pubkey: ""
operator_pubkey: "npub1gnwpctdec0aa00hfy4lvadftu08ccs9677mr73h9ddv2zvw8fu9smmerrq"
allowlist: []
blocklist: []
curation_sets: []
@@ -44,15 +51,23 @@ network:
url: ""
publisher:
enabled: false
outbox: []
publish_delay_secs: 1800
enabled: true
outbox:
- "wss://freelay.sovbit.dev"
- "wss://freelay.sovbit.host"
publish_delay_secs: 0
identity:
nsec: ""
nsec: "nsec1uszemvvqhv4agy8alggnrmw4h4qmhdgr4ahrv4tqz08c8hsusfrqrmnmva"
bunker_url: ""
qbittorrent:
url: "http://127.0.0.1:8080"
username: "admin"
url: ""
username: ""
password: ""
poll_interval_secs: 60
poll_interval_secs: 0
categories: []
deluge:
enabled: true
url: "http://127.0.0.1:8112"
password: "q1w2e3r4t5"
poll_interval_secs: 60
labels: []
+8 -2
View File
@@ -2,7 +2,6 @@ use anyhow::{bail, Context};
use reqwest::Client;
use serde::Deserialize;
use serde_json::{json, Value};
use std::collections::HashMap;
use tracing::debug;
pub struct DelugeClient {
@@ -36,10 +35,17 @@ struct RpcResponse {
impl DelugeClient {
pub fn new(url: &str, password: &str) -> Self {
// Disable connection pooling — Deluge's Twisted HTTP server closes
// keep-alive connections aggressively, causing "connection closed before
// message completed" errors when reqwest tries to reuse a stale connection.
let http = Client::builder()
.pool_max_idle_per_host(0)
.build()
.unwrap_or_default();
DelugeClient {
url: url.trim_end_matches('/').to_owned(),
password: password.to_owned(),
http: Client::new(),
http,
}
}
+1 -1
View File
@@ -94,7 +94,7 @@ impl Watcher {
}
}
}
Err(e) => warn!("deluge poll failed: {e}"),
Err(e) => warn!("deluge poll failed: {e:#}"),
}
tokio::time::sleep(interval).await;
}
-11
View File
@@ -27,18 +27,8 @@ pub async fn handler(
async fn render(state: &AppState, params: &PageParams) -> anyhow::Result<Html<String>> {
let cfg = &state.cfg;
let has_overrides = db::settings_count(&state.pool).await > 0;
let api_keys = db::list_api_keys(&state.pool).await.unwrap_or_default();
let restart_banner = if has_overrides {
r#"<div class="banner-restart">
<strong>Restart required</strong> — settings have been saved to the database.
Restart kindexr to apply them.
</div>"#
} else {
""
};
let flash = if let Some(key) = &params.newkey {
let label = params.keylabel.as_deref().unwrap_or("new key");
format!(
@@ -377,7 +367,6 @@ function copyKey() {
let body = format!(
r#"<h1>Settings</h1>
{flash}
{restart_banner}
<div class="section">
<div class="section-title">API Keys</div>
{apikeys_section}