chore: fix rooms out of order while loading (#139)

* fix room out of order while loading

* .

* .
This commit is contained in:
reya
2025-09-03 09:16:36 +07:00
committed by GitHub
parent d392602ed6
commit d8edac0bb9
7 changed files with 150 additions and 126 deletions

View File

@@ -117,6 +117,17 @@ pub struct CoopSimpleStorage {
pub resend_queue: RwLock<HashMap<EventId, RelayUrl>>,
}
impl CoopSimpleStorage {
pub fn new() -> Self {
Self {
init_at: Timestamp::now(),
sent_ids: RwLock::new(HashSet::new()),
resent_ids: RwLock::new(Vec::new()),
resend_queue: RwLock::new(HashMap::new()),
}
}
}
static NOSTR_CLIENT: OnceLock<Client> = OnceLock::new();
static INGESTER: OnceLock<Ingester> = OnceLock::new();
static COOP_SIMPLE_STORAGE: OnceLock<CoopSimpleStorage> = OnceLock::new();
@@ -150,7 +161,7 @@ pub fn ingester() -> &'static Ingester {
}
pub fn css() -> &'static CoopSimpleStorage {
COOP_SIMPLE_STORAGE.get_or_init(CoopSimpleStorage::default)
COOP_SIMPLE_STORAGE.get_or_init(CoopSimpleStorage::new)
}
pub fn first_run() -> &'static bool {