chore: connect bootstrap relays on demand #25
+3
-1
@@ -15,7 +15,9 @@
|
|||||||
- Migrate the GPUI foundation to the published `gpui-pre` crates and GPUI Kit 0.6, off the zed and gpui-component git pins
|
- Migrate the GPUI foundation to the published `gpui-pre` crates and GPUI Kit 0.6, off the zed and gpui-component git pins
|
||||||
- Use the pixel avatar as the single fallback for a missing picture, sized and rounded to match the other avatars
|
- Use the pixel avatar as the single fallback for a missing picture, sized and rounded to match the other avatars
|
||||||
- Redesign the dock tab bar, using muted grey active tab, added close buttons, double-click to zoom, and removed panel toolbar
|
- Redesign the dock tab bar, using muted grey active tab, added close buttons, double-click to zoom, and removed panel toolbar
|
||||||
- Connect to fewer relays at startup, keeping only ditto and the git indexer as bootstrap relays
|
- Connect to bootstrap relays on demand instead of at startup
|
||||||
|
- Fetch profile metadata in batches of 100 authors, applying every requested profile in a single database query
|
||||||
|
- Prefetch the 500 most recent profiles at startup instead of 200
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ use gpui::{
|
|||||||
use nostr_sdk::prelude::*;
|
use nostr_sdk::prelude::*;
|
||||||
use utils::shorten_pubkey;
|
use utils::shorten_pubkey;
|
||||||
|
|
||||||
use crate::backend::{Backend, BackendEvent, subscribe_bootstrap_only};
|
use crate::backend::{Backend, BackendEvent, sync_bootstrap_only};
|
||||||
|
|
||||||
/// How long to wait for more requests before firing a batched fetch.
|
/// How long to wait for more requests before firing a batched fetch.
|
||||||
const BATCH_TIMEOUT: Duration = Duration::from_millis(500);
|
const BATCH_TIMEOUT: Duration = Duration::from_millis(500);
|
||||||
@@ -282,11 +282,12 @@ impl ProfileStore {
|
|||||||
let authors: Vec<PublicKey> = batch.drain().collect();
|
let authors: Vec<PublicKey> = batch.drain().collect();
|
||||||
|
|
||||||
for chunk in authors.chunks(REQUEST_CHUNK) {
|
for chunk in authors.chunks(REQUEST_CHUNK) {
|
||||||
|
let opts = SyncOptions::default();
|
||||||
let filter = Filter::new()
|
let filter = Filter::new()
|
||||||
.kind(Kind::Metadata)
|
.kind(Kind::Metadata)
|
||||||
.authors(chunk.iter().copied());
|
.authors(chunk.iter().copied());
|
||||||
|
|
||||||
if let Err(e) = subscribe_bootstrap_only(client, vec![filter]).await {
|
if let Err(e) = sync_bootstrap_only(client, filter, opts).await {
|
||||||
log::warn!("profile fetch failed: {e}");
|
log::warn!("profile fetch failed: {e}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user