Skip to content

Commit 2d28037

Browse files
tlongwell-blockPerciMaxWrenMeli
authored
perf(desktop): persist channel heads, collapse thread reads and reply sends (#6572)
## Summary Lands the build-now items from the desktop latency plan (#ui-performance-deep-dive) as one change. Every perceived-latency hot path a user hits on launch, channel open, thread open, and reply send drops one or more round trips. **A1 — persisted channel heads (the big one).** Native WAL SQLite cache (`desktop/src-tauri/src/channel_head_cache.rs`) keyed by `{pubkey, relayUrl}` scope, 32 rows/scope LRU, 1 MiB per-row drop cap, schema-version reset, corrupt-row tolerance, checkpointed on shutdown. Three blocking-pool commands: `channel_head_cache_load` / `_store` / `_clear`. On the renderer side, `CommunityQueryProvider` kicks off hydration of up to 12 heads when it constructs the query client — the app, splash and relay preconnect mount immediately; only `useChannelMessagesQuery` awaits the seed (`channelHeadHydration`), then consumes a one-shot hydrated gate so a hydrated channel pays **zero** `get_channel_window` calls on mount and exactly **one** on the post-subscription refresh, whose response replaces page zero wholesale. That refresh fires whether live-subscription setup succeeds or fails, and is sequenced behind hydration so it is always a distinct authoritative fetch (see Review follow-ups). Bounds-only persisted heads (zero rows) are not hydrated and take the cold loading path. The timeline loading latch recognizes native-hydrated rows as restart-safe so they paint immediately instead of holding a skeleton. The cache is a paint accelerator only — the relay response is always authoritative. Replaces the legacy localStorage `messageSnapshot.ts` (removed, -401 lines). Kill switch: `VITE_BUZZ_CHANNEL_HEAD_CACHE=off` at build time or `localStorage["buzz-channel-head-cache"] = "off"` at runtime. Cache is cleared on community removal and scoped per identity, so a replaced signer never sees the previous identity's rows. **B1 — thread aux in one response.** Relay thread filters accept `include_aux`; the bridge appends the same authorized two-hop reactions/edits/deletions closure a channel window gets (`build_aux_query` shared with the window path). Renderer `useThreadReplies` drops its two follow-up aux fetches. `next_cursor` is computed from reply-kind rows only since aux rows are unpaged. Documented in `docs/bridge-channel-window.md`. Thread queries keep `staleTime: 0` (`bcfe04e2f`): an earlier revision raised it to 30s, which CI's `thread-unread.spec.ts` caught — once the user leaves a channel, the live subscription stops feeding that thread's cache, so a reopen must always take the (now single) authoritative read. **B2 — cached root on reply send.** `send_channel_message` gains `root_event_id`; when the renderer already holds the parent (channel or thread cache) it passes the NIP-10 root, and native signs without the relay round trip that `resolve_thread_ref` used to make. Strict hex parse; `root_event_id` requires `parent_event_id`; absent root falls back to the existing relay resolution. The renderer never sends a guessed root. **B4** general HTTP pool idle 10s→300s, max idle per host 1→2. **B5** relay preconnect fires as soon as identity is ready instead of waiting for `requestIdleCallback`. One e2e test (`relay-reconnect.spec.ts` "service restart close resets accumulated backoff") had been relying on the idle-callback batching to skip past its own seeded dial failures before the channel list painted; `8133d70bb` makes it wait for the connected state instead (test-only, still fails with the 1012 backoff reset disabled). **B6** profile freshness 60s→10 min (both the in-memory entry check and the query `staleTime`). Tradeoff: another user's display-name/avatar edit can take up to 10 min to propagate to a client that already holds their profile (relay reconnect refetches `users-batch` but resolves from the still-fresh per-pubkey entry); your own edits still evict the entry immediately (`evictUsersBatchEntries` in `useUpdateProfileMutation`). ### Related issue Follows #6456/#6457/#6459/#6460 (already merged). #6455 is the measurement instrument and is intentionally not folded in. No duplicate PR found. ### Review follow-ups Addressing Carl's reviews [5001114109](#6572 (review)) and [5002596542](#6572 (review)), each pushed as new commits (no rebase): - `4f06b7770` fix(desktop): mount app while channel heads hydrate; always revalidate — provider no longer gates children on the cache load; `refreshAfterSubscribe` runs on subscribe failure too; bounds-only heads skipped at seed; seed merges into an existing window store. +3 tests. - `35834cb31` fix(relay): drain aux closure hops across the page clamp — `query_all_pages` walks the `(created_at, id)` keyset via `until`/`before_id` until a short page (`AUX_PAGE_LIMIT` = `DEFAULT_MAX_PAGE_LIMIT`, `AUX_MAX_PAGES` = 64 warn+truncate) so one-shot `limit: 1000` newest-first no longer drops the oldest edits/deletions. +3 tests; `docs/bridge-channel-window.md` updated. - `db21b0531` merge of `origin/main` `e23632941` (#6558, #6312 — no overlap). - `5a5566c0f` fix(desktop): sequence post-subscribe refresh behind channel head hydration — `refreshChannelWindowMessages` awaits `channelHeadHydration()` and, for a hydration-seeded query (`data !== undefined && dataUpdatedAt === 0`), the in-flight snapshot fetch before invalidating. Without this, a subscription that settles before the SQLite load invalidated a data-less in-flight query; TanStack dedupes that onto the existing fetch (`query-core` `fetch()` only cancels when `state.data` exists), which returned the seeded snapshot — 0 authoritative fetches. Regression test reproduces Carl's exact ordering (fails at `35834cb31` with 0 calls), plus a cold-channel guard that the fix does not double-fetch. - `b129231c8` fix(desktop): let concurrent post-hydration refreshes share one window fetch — found independently by Max and Wren reviewing `5a5566c0f`: subscribe settlement + reconnect both wake on the same snapshot promise and both invalidate; the second (default `cancelRefetch: true`) cancelled and replaced the first authoritative fetch (3 queryFn calls, not 2, and the cancelled Tauri invoke still hits the relay). The seeded branch now invalidates with `cancelRefetch: false` so a second waker joins the in-flight fetch; cold/warm keep the default (`test_canceled_stale_fetch_cannot_overwrite_catch_up_window` relies on it). Concurrent regression test fails at `5a5566c0f` with 3. ### Testing At `b129231c8` (PR head; verified in one shell with `git rev-parse HEAD` = `b129231c8`): `pnpm check`, `tsc --noEmit`, desktop unit 5,393 / 0, Playwright `boot-splash` + `channel-head-restart` + `relay-reconnect` + `relay-reconnect-affordance` + `thread-unread` 34 / 34 on a fresh `build:e2e`, pre-push hooks green. At `5a5566c0f`: `pnpm check`, `tsc --noEmit`, desktop unit 5,392 / 0, Playwright `boot-splash` + `channel-head-restart` + `relay-reconnect` + `relay-reconnect-affordance` + `thread-unread` 34 / 34 on a fresh `build:e2e`, pre-push hooks green. At `35834cb31`: desktop unit 5,390 / 0; `cargo test -p buzz-relay --lib` 910 / 0; fmt + clippy `-D warnings` clean; Playwright 32 / 32 (same specs minus affordance); GitHub CI green on every job except Smoke (3) (unrelated project-review row-count + messaging timing flake, per Carl) and Unit Tests (sherpa cache skeleton, below). Earlier, all at `8133d70bb` (this PR head is `0c492366d` = 8133d70 + a comments-only commit correcting two `profile/hooks.ts` freshness comments from 60s to 10 min; pre-push desktop check/typecheck/test 5,387/0 re-ran at 0c49236) in one shell; `origin/main` = `040b203f7` at PR open, since moved to `4baccd539` (#6558, mobile only — zero file overlap, `git merge-tree` clean): - `just desktop-test` — 5,387 passed / 0 failed (includes new hook-level call-count test: cold = 1, stale-prefetched = 1, hydrated = 0 on mount then 1 on invalidate with wholesale replacement) - Playwright smoke `relay-reconnect.spec.ts` + `thread-unread.spec.ts` + `channel-head-restart.spec.ts` — 30/30 (thread-unread was 8/13 at `7acbf951b`; relay-reconnect was 15/16 at `bcfe04e2f`). The restart spec persists a head, reloads into a fresh mock relay with the head fetch held 5s, asserts the persisted row paints within 2s, exactly one `get_channel_window` after open, and the stale row is removed when the authoritative page lands. - `pnpm typecheck`, `pnpm check` — clean At `7acbf951b` (everything except the two-line `useThreadReplies.ts` staleTime revert and the test-only `relay-reconnect.spec.ts` change), also green in one shell: - `just desktop-tauri-test` — 2,859 passed / 0 failed across the workspace (channel_head_cache: wire shape, LRU+caps, schema reset, corrupt-row skip) - `just test-unit` — 632 passed (buzz-core/auth); `cargo test -p buzz-relay --lib` — 908 passed / 0 failed - `just check` components: fmt-check, clippy, desktop-check, desktop-typecheck, desktop-tauri-fmt-check, desktop-tauri-clippy, web-check, mobile-check, file-size-check — all green - `just desktop-build`, `web-build`, `desktop-tauri-check`, `mobile-test` (1,661 passed) — all green CI note: the "Unit Tests" job goes red on this PR and on `main` whenever it hits a poisoned `rust-cache` entry (an empty-directory skeleton of `target/sherpa-onnx-prebuilt` that `sherpa-onnx-sys` build.rs trusts), surfacing as `could not find native static library sherpa-onnx-c-api` in `buzz-voice` — a crate this PR doesn't touch. Deleting the cache entry and rerunning turned the job green at `0c492366d` (28/28); it re-poisons on the next `main` push until the workflow clears that directory after cache restore. Reviewed in-channel by Wren (9 / 9 / 9.5) and Eva (9 / 9 / 9), and line-by-line by me before opening; the staleTime fix re-verified by Wren and me independently; the relay-reconnect test fix bisected and verified by me. --------- Signed-off-by: Perci <5a968df9a7494b4e019b9ecf739e088ba61097b4312124e9a88ae5b42e3f5f3e@buzz.block.builderlab.xyz> Signed-off-by: Max <d8473ee32b973aa31a21a65adddcc4b69cc2a8a4dee8121ecd51926e0cddbc02@buzz.block.builderlab.xyz> Signed-off-by: Wren <5217c5c2f7bfb4333e46d17c98a9255a52dadee18dcd43a43536b95e6776dfa0@buzz.block.builderlab.xyz> Signed-off-by: Meli <5aaa86bce934fc3445fc254aab560a40923f10252f92107e665073dede0e04d3@buzz.block.builderlab.xyz> Co-authored-by: Perci <5a968df9a7494b4e019b9ecf739e088ba61097b4312124e9a88ae5b42e3f5f3e@buzz.block.builderlab.xyz> Co-authored-by: Max <d8473ee32b973aa31a21a65adddcc4b69cc2a8a4dee8121ecd51926e0cddbc02@buzz.block.builderlab.xyz> Co-authored-by: Wren <5217c5c2f7bfb4333e46d17c98a9255a52dadee18dcd43a43536b95e6776dfa0@buzz.block.builderlab.xyz> Co-authored-by: Meli <5aaa86bce934fc3445fc254aab560a40923f10252f92107e665073dede0e04d3@buzz.block.builderlab.xyz>
1 parent 0720f53 commit 2d28037

32 files changed

Lines changed: 1701 additions & 616 deletions

‎crates/buzz-relay/src/api/bridge.rs‎

Lines changed: 230 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,83 @@ const WINDOW_AUX_DELETE_KINDS: [u32; 2] = [
393393
buzz_core::kind::KIND_NIP29_DELETE_EVENT,
394394
];
395395

396+
/// Page size for one aux-closure hop. Matches the DB clamp
397+
/// (`buzz_db::DEFAULT_MAX_PAGE_LIMIT`) so each page is one full query.
398+
const AUX_PAGE_LIMIT: i64 = buzz_db::DEFAULT_MAX_PAGE_LIMIT;
399+
/// Upper bound on pages drained per hop: 64k aux events referencing one page
400+
/// of rows is far past any real thread; past it we log and stop rather than
401+
/// loop forever against a pathological write pattern.
402+
const AUX_MAX_PAGES: usize = 64;
403+
404+
fn build_aux_query(
405+
community: buzz_core::CommunityId,
406+
target_ids: Vec<String>,
407+
kinds: &[u32],
408+
) -> buzz_db::EventQuery {
409+
let mut query = buzz_db::EventQuery::for_community(community);
410+
query.kinds = Some(kinds.iter().map(|kind| *kind as i32).collect());
411+
query.e_tags = Some(target_ids);
412+
query
413+
}
414+
415+
/// Where an aux hop reads from: the window path pins the request's proved
416+
/// read session; the thread path takes the routed display-read fast path.
417+
enum AuxReader<'a> {
418+
Session(&'a mut buzz_db::ReadSession),
419+
Routed(&'a buzz_db::Db, &'static str),
420+
#[cfg(test)]
421+
Fake(&'a mut (dyn FnMut(&buzz_db::EventQuery) -> Vec<buzz_core::StoredEvent> + Send)),
422+
}
423+
424+
impl AuxReader<'_> {
425+
async fn fetch(
426+
&mut self,
427+
query: &buzz_db::EventQuery,
428+
) -> buzz_db::Result<Vec<buzz_core::StoredEvent>> {
429+
match self {
430+
AuxReader::Session(session) => session.query_events(query).await,
431+
AuxReader::Routed(db, path) => db.query_events_routed(path, query).await,
432+
#[cfg(test)]
433+
AuxReader::Fake(fetch) => Ok(fetch(query)),
434+
}
435+
}
436+
}
437+
438+
/// Drain every event matching `query`, walking the `(created_at, id)` keyset
439+
/// cursor `query_events` already orders by until a short page. An aux hop
440+
/// over a reaction-heavy page can exceed a single page clamp, and because
441+
/// results are newest-first a one-shot query silently drops the *oldest*
442+
/// edits and deletions — rendering original or deleted content, not merely
443+
/// losing decoration.
444+
async fn query_all_pages(
445+
mut query: buzz_db::EventQuery,
446+
page_limit: i64,
447+
reader: &mut AuxReader<'_>,
448+
) -> buzz_db::Result<Vec<buzz_core::StoredEvent>> {
449+
query.limit = Some(page_limit);
450+
let mut events = Vec::new();
451+
for _ in 0..AUX_MAX_PAGES {
452+
let page = reader.fetch(&query).await?;
453+
let next = if page.len() as i64 >= page_limit {
454+
page.last().map(|se| (se.event.created_at, se.event.id))
455+
} else {
456+
None
457+
};
458+
events.extend(page);
459+
let Some((created_at, id)) = next else {
460+
return Ok(events);
461+
};
462+
query.until = chrono::DateTime::from_timestamp(created_at.as_secs() as i64, 0);
463+
query.before_id = Some(id.to_bytes().to_vec());
464+
}
465+
tracing::warn!(
466+
pages = AUX_MAX_PAGES,
467+
events = events.len(),
468+
"aux closure hop exceeded page cap; returning truncated closure"
469+
);
470+
Ok(events)
471+
}
472+
396473
/// Serve one `top_level: true` channel-window filter on the bridge `/query`
397474
/// path (docs/bridge-channel-window.md). Appends, in order: row events, the
398475
/// aux closure (`include_aux`), `39005` thread-summary overlays
@@ -496,14 +573,15 @@ async fn handle_channel_window_filter(
496573
std::collections::HashSet::new();
497574
let mut hop_ids = row_ids_hex.clone();
498575
for hop_kinds in [&WINDOW_AUX_KINDS[..], &WINDOW_AUX_DELETE_KINDS[..]] {
499-
let mut aux_query = buzz_db::EventQuery::for_community(tenant.community());
500-
aux_query.kinds = Some(hop_kinds.iter().map(|k| *k as i32).collect());
501-
aux_query.e_tags = Some(std::mem::take(&mut hop_ids));
502-
aux_query.limit = Some(1000);
503-
let aux_events = session
504-
.query_events(&aux_query)
505-
.await
506-
.map_err(|e| internal_error(&format!("window aux error: {e}")))?;
576+
let aux_query =
577+
build_aux_query(tenant.community(), std::mem::take(&mut hop_ids), hop_kinds);
578+
let aux_events = query_all_pages(
579+
aux_query,
580+
AUX_PAGE_LIMIT,
581+
&mut AuxReader::Session(&mut session),
582+
)
583+
.await
584+
.map_err(|e| internal_error(&format!("window aux error: {e}")))?;
507585
for se in aux_events {
508586
if !seen_aux.insert(se.event.id) {
509587
continue;
@@ -1203,6 +1281,8 @@ async fn query_events_authed(
12031281
.await
12041282
.map_err(|e| internal_error(&format!("thread query error: {e}")))?;
12051283

1284+
let mut thread_row_ids = Vec::with_capacity(thread_replies.len() + 1);
1285+
thread_row_ids.push(root_hex.to_string());
12061286
for reply in thread_replies {
12071287
let se = reply.stored_event;
12081288
if !event_in_accessible_channel(&se, &accessible_channels) {
@@ -1214,10 +1294,45 @@ async fn query_events_authed(
12141294
if !buzz_core::filter::reader_authorized_for_event(&se.event, &authed_pubkey_hex) {
12151295
continue;
12161296
}
1297+
thread_row_ids.push(se.event.id.to_hex());
12171298
if let Ok(v) = serde_json::to_value(&se.event) {
12181299
events.push(v);
12191300
}
12201301
}
1302+
1303+
if extension_flag(raw, "include_aux") && !thread_row_ids.is_empty() {
1304+
let mut seen_aux = std::collections::HashSet::new();
1305+
let mut hop_ids = thread_row_ids;
1306+
for hop_kinds in [&WINDOW_AUX_KINDS[..], &WINDOW_AUX_DELETE_KINDS[..]] {
1307+
let aux_query =
1308+
build_aux_query(tenant.community(), std::mem::take(&mut hop_ids), hop_kinds);
1309+
let aux_events = query_all_pages(
1310+
aux_query,
1311+
AUX_PAGE_LIMIT,
1312+
&mut AuxReader::Routed(&state.db, "bridge_thread_aux"),
1313+
)
1314+
.await
1315+
.map_err(|e| internal_error(&format!("thread aux query error: {e}")))?;
1316+
for se in aux_events {
1317+
if !seen_aux.insert(se.event.id)
1318+
|| !event_in_accessible_channel(&se, &accessible_channels)
1319+
|| !buzz_core::filter::reader_authorized_for_event(
1320+
&se.event,
1321+
&authed_pubkey_hex,
1322+
)
1323+
{
1324+
continue;
1325+
}
1326+
hop_ids.push(se.event.id.to_hex());
1327+
if let Ok(value) = serde_json::to_value(&se.event) {
1328+
events.push(value);
1329+
}
1330+
}
1331+
if hop_ids.is_empty() {
1332+
break;
1333+
}
1334+
}
1335+
}
12211336
handled.insert(idx);
12221337
}
12231338

@@ -2373,6 +2488,113 @@ mod tests {
23732488
assert!(!has_mixed_search_filters(&filters));
23742489
}
23752490

2491+
#[test]
2492+
fn thread_aux_query_targets_root_and_replies() {
2493+
let tenant = fresh_tenant("relay.example");
2494+
let targets = vec!["root".to_string(), "reply".to_string()];
2495+
let query = build_aux_query(tenant.community(), targets.clone(), &WINDOW_AUX_KINDS);
2496+
2497+
assert_eq!(query.e_tags, Some(targets));
2498+
assert_eq!(
2499+
query.kinds,
2500+
Some(WINDOW_AUX_KINDS.iter().map(|kind| *kind as i32).collect())
2501+
);
2502+
assert_eq!(query.limit, None);
2503+
assert_eq!(query.until, None);
2504+
assert_eq!(query.before_id, None);
2505+
}
2506+
2507+
fn aux_event(keys: &Keys, created_at: u64, content: &str) -> buzz_core::StoredEvent {
2508+
let ev = EventBuilder::new(Kind::Custom(7), content)
2509+
.custom_created_at(nostr::Timestamp::from(created_at))
2510+
.sign_with_keys(keys)
2511+
.unwrap();
2512+
buzz_core::StoredEvent::new(ev, None)
2513+
}
2514+
2515+
/// Carl/#6572: a one-shot `limit=1000` aux query is newest-first, so the
2516+
/// oldest reactions/edits/deletions past the clamp vanished. The paged
2517+
/// drain must walk the keyset cursor until a short page and return every
2518+
/// event exactly once.
2519+
#[tokio::test]
2520+
async fn query_all_pages_drains_past_the_page_clamp() {
2521+
let keys = Keys::generate();
2522+
// Newest-first store: 5 events, two sharing a second so the id
2523+
// tiebreak is exercised.
2524+
let mut store = [
2525+
aux_event(&keys, 50, "e"),
2526+
aux_event(&keys, 40, "d1"),
2527+
aux_event(&keys, 40, "d2"),
2528+
aux_event(&keys, 30, "c"),
2529+
aux_event(&keys, 10, "a"),
2530+
];
2531+
store.sort_by(|l, r| {
2532+
r.event
2533+
.created_at
2534+
.cmp(&l.event.created_at)
2535+
.then(l.event.id.cmp(&r.event.id))
2536+
});
2537+
let expected: Vec<_> = store.iter().map(|se| se.event.id).collect();
2538+
let mut calls = Vec::new();
2539+
2540+
let tenant = fresh_tenant("relay.example");
2541+
let query = build_aux_query(tenant.community(), vec!["root".into()], &WINDOW_AUX_KINDS);
2542+
let mut fetch = |q: &buzz_db::EventQuery| {
2543+
calls.push((q.limit, q.until, q.before_id.clone()));
2544+
// Emulate `query_events_on`: `created_at < until OR
2545+
// (created_at = until AND id > before_id)`, newest-first, limit.
2546+
let page: Vec<_> = store
2547+
.iter()
2548+
.filter(|se| match (q.until, q.before_id.as_deref()) {
2549+
(Some(until), Some(before)) => {
2550+
let ts = se.event.created_at.as_secs() as i64;
2551+
ts < until.timestamp()
2552+
|| (ts == until.timestamp()
2553+
&& se.event.id.as_bytes().as_slice() > before)
2554+
}
2555+
_ => true,
2556+
})
2557+
.take(q.limit.unwrap() as usize)
2558+
.cloned()
2559+
.collect();
2560+
page
2561+
};
2562+
let events = query_all_pages(query, 2, &mut AuxReader::Fake(&mut fetch))
2563+
.await
2564+
.unwrap();
2565+
2566+
assert_eq!(
2567+
events.iter().map(|se| se.event.id).collect::<Vec<_>>(),
2568+
expected
2569+
);
2570+
assert_eq!(calls.len(), 3, "2 full pages + 1 short page");
2571+
assert!(calls.iter().all(|(limit, _, _)| *limit == Some(2)));
2572+
assert_eq!(calls[0].1, None);
2573+
// Second page resumes from the last row of the first (ts 40, larger id).
2574+
assert_eq!(calls[1].1.unwrap().timestamp(), 40);
2575+
assert_eq!(
2576+
calls[1].2.as_deref(),
2577+
Some(store[1].event.id.as_bytes().as_slice())
2578+
);
2579+
assert_eq!(calls[2].1.unwrap().timestamp(), 30);
2580+
}
2581+
2582+
#[tokio::test]
2583+
async fn query_all_pages_stops_at_one_short_page() {
2584+
let tenant = fresh_tenant("relay.example");
2585+
let query = build_aux_query(tenant.community(), vec!["root".into()], &WINDOW_AUX_KINDS);
2586+
let mut calls = 0;
2587+
let mut fetch = |_q: &buzz_db::EventQuery| {
2588+
calls += 1;
2589+
Vec::new()
2590+
};
2591+
let events = query_all_pages(query, 1000, &mut AuxReader::Fake(&mut fetch))
2592+
.await
2593+
.unwrap();
2594+
assert!(events.is_empty());
2595+
assert_eq!(calls, 1);
2596+
}
2597+
23762598
#[test]
23772599
fn bridge_search_mode_extension_defaults_to_full_text() {
23782600
assert_eq!(

‎desktop/playwright.config.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ export default defineConfig({
9999
"**/scroll-history.spec.ts",
100100
"**/channel-dense-second-reach.spec.ts",
101101
"**/channel-window-mock-paging.spec.ts",
102+
"**/channel-head-restart.spec.ts",
102103
"**/live-broadcast-reply-timeline.spec.ts",
103104
"**/markdown-parse-cache.spec.ts",
104105
"**/overscroll-boundary.spec.ts",

‎desktop/src-tauri/src/app_state.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,8 @@ pub fn build_app_state() -> AppState {
194194
identity_storage: AtomicU8::new(identity_storage as u8),
195195
http_client: reqwest::Client::builder()
196196
.resolve("localhost", std::net::SocketAddr::from(([127, 0, 0, 1], 0)))
197-
.pool_idle_timeout(std::time::Duration::from_secs(10))
198-
.pool_max_idle_per_host(1)
197+
.pool_idle_timeout(std::time::Duration::from_secs(300))
198+
.pool_max_idle_per_host(2)
199199
.build()
200200
.unwrap_or_else(|_| reqwest::Client::new()),
201201
media_fetch_client: build_media_fetch_client().expect(

0 commit comments

Comments
 (0)