wip: refactor

This commit is contained in:
reya
2025-01-02 20:57:59 +07:00
parent 51b392a845
commit 17dc98402f
9 changed files with 63 additions and 46 deletions
+14 -13
View File
@@ -1,4 +1,3 @@
use async_utility::task::spawn;
use gpui::*;
use nostr_sdk::prelude::*;
use std::time::Duration;
@@ -41,19 +40,21 @@ impl AccountRegistry {
.pubkey(public_key)
.limit(0);
spawn(async move {
// Subscribe for all messages
if client
.subscribe_with_id(all_messages_sub_id, vec![all_messages], Some(opts))
.await
.is_ok()
{
// Subscribe for new message
_ = client
.subscribe_with_id(new_message_sub_id, vec![new_message], None)
cx.background_executor()
.spawn(async move {
// Subscribe for all messages
if client
.subscribe_with_id(all_messages_sub_id, vec![all_messages], Some(opts))
.await
}
});
.is_ok()
{
// Subscribe for new message
_ = client
.subscribe_with_id(new_message_sub_id, vec![new_message], None)
.await
}
})
.detach();
}
})
.detach();
-1
View File
@@ -22,7 +22,6 @@ impl MetadataRegistry {
if !seens.contains(&public_key) {
seens.push(public_key);
drop(seens);
if let Some(metadata) = metadata {