notedeck

One damus client to rule them all
git clone git://jb55.com/notedeck
Log | Files | Refs | README | LICENSE

commit db8777572a765f5e47f5868a49d0000b8e9ef632
parent ba498f2fba0e7778126e82c4226c405a6817e8cb
Author: William Casarin <jb55@jb55.com>
Date:   Sat, 27 Dec 2025 11:42:46 -0800

messages: fix hang on startup

Signed-off-by: William Casarin <jb55@jb55.com>

Diffstat:
Mcrates/notedeck_messages/src/lib.rs | 20++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/crates/notedeck_messages/src/lib.rs b/crates/notedeck_messages/src/lib.rs @@ -55,8 +55,24 @@ impl App for MessagesApp { }; ctx.ndb.add_key(&secret.secret_bytes()); - let txn = Transaction::new(ctx.ndb).expect("txn"); - ctx.ndb.process_giftwraps(&txn); + + let giftwrap_ndb = ctx.ndb.clone(); + let r = std::thread::Builder::new() + .name("process_giftwraps".into()) + .spawn(move || { + let txn = Transaction::new(&giftwrap_ndb).expect("txn"); + // although the actual giftwrap processing happens on the ingestion pool, this + // function still looks up giftwraps to process on the main thread, which can + // cause a freeze. + // + // TODO(jb55): move the giftwrap query logic into the internal threadpool so we + // don't have to spawn a thread here + giftwrap_ndb.process_giftwraps(&txn); + }); + + if let Err(err) = r { + tracing::error!("failed to spawn process_giftwraps thread: {err}"); + } } match cache.state {