Skip to content

Commit 499f523

Browse files
committed
Use patched async-utility to support task::spawn_blocking also in WASM
Signed-off-by: Yuki Kishimoto <[email protected]>
1 parent b824198 commit 499f523

File tree

6 files changed

+8
-8
lines changed

6 files changed

+8
-8
lines changed

Cargo.lock

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ web-sys = { version = "0.3", default-features = false }
5252
[patch.crates-io]
5353
# Patch needed to reduce bindings size
5454
bip39 = { git = "https://github.com/rust-bitcoin/rust-bip39", rev = "256a00e7c23c5b2ecc04df90894f60248c8d56d5" }
55+
async-utility = { git = "https://github.com/yukibtc/async-utility", rev = "a232e277162ff60011d54a65a706422c8a9afd06" }
5556

5657
[profile.release]
5758
lto = true

crates/nostr-lmdb/src/store/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55

66
use std::{fmt, io};
77

8+
use async_utility::task::Error as JoinError;
89
use nostr::{key, secp256k1};
910
use nostr_database::flatbuffers;
10-
use tokio::task::JoinError;
1111

1212
#[derive(Debug)]
1313
pub enum Error {

crates/nostr-lmdb/src/store/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ impl Store {
5353
R: Send + 'static,
5454
{
5555
let db = self.db.clone();
56-
Ok(task::spawn_blocking(move || f(db)).await?)
56+
Ok(task::spawn_blocking(move || f(db)).join().await?)
5757
}
5858

5959
#[inline]
@@ -65,7 +65,7 @@ impl Store {
6565
let db = self.db.clone();
6666
let arc_fbb = self.fbb.clone();
6767
let mut fbb = arc_fbb.lock_owned().await;
68-
Ok(task::spawn_blocking(move || f(db, &mut fbb)).await?)
68+
Ok(task::spawn_blocking(move || f(db, &mut fbb)).join().await?)
6969
}
7070

7171
/// Store an event.

crates/nostr-redb/src/store/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55

66
use std::{fmt, io};
77

8+
use async_utility::task::Error as JoinError;
89
use nostr::{key, secp256k1};
910
use nostr_database::flatbuffers;
10-
use tokio::task::JoinError;
1111

1212
#[derive(Debug)]
1313
pub enum Error {

crates/nostr-redb/src/store/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ impl Store {
6363
R: Send + 'static,
6464
{
6565
let db = self.db.clone();
66-
Ok(task::spawn_blocking(move || f(db)).await?)
66+
Ok(task::spawn_blocking(move || f(db)).join().await?)
6767
}
6868

6969
#[inline]
@@ -75,7 +75,7 @@ impl Store {
7575
let db = self.db.clone();
7676
let arc_fbb = self.fbb.clone();
7777
let mut fbb = arc_fbb.lock_owned().await;
78-
Ok(task::spawn_blocking(move || f(db, &mut fbb)).await?)
78+
Ok(task::spawn_blocking(move || f(db, &mut fbb)).join().await?)
7979
}
8080

8181
/// Store an event.

0 commit comments

Comments
 (0)