Skip to content

Commit 453d057

Browse files
fix(relay): format the new import, and bound the mint wait
Two review findings from Greptile on the contributed change, neither about the fix itself: - `cargo fmt --all --check` failed: `use tokio::sync::Notify` sat inside the futures import group, before the `nostream_config` block, so the required format step would have stopped the checks before the test ran. - `create_started().await` had no deadline, so a handler that panicked before minting would hang the test instead of failing it. The wait is now wrapped in a five-second timeout with a message that says which wait expired. `cargo fmt --all --check` is clean, and `cargo test -p nostream-relay --test handlers a_close_during_the_invite_mint` passes.
1 parent a178e9c commit 453d057

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

‎crates/nostream-relay/src/testing.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ use std::sync::{Arc, Mutex};
1616

1717
use futures_util::StreamExt;
1818
use futures_util::stream;
19-
use tokio::sync::Notify;
2019
use nostream_config::settings::{
2120
Info, Network, Nip42Settings, Nip43Settings, Nip45Settings, Nip50Settings, Nip56Settings,
2221
RateLimiterSettings, Settings,
@@ -30,6 +29,7 @@ use nostream_storage::repositories::{
3029
NewReport, Nip05Verification, Nip05VerificationRepository, QueryStream, ReconciliationItem,
3130
Report, ReportRepository, StorageFuture, User, UserPatch, UserRepository,
3231
};
32+
use tokio::sync::Notify;
3333

3434
use crate::connection::{Connection, Subscription};
3535
use crate::error::RelayError;

‎crates/nostream-relay/tests/handlers.rs‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1263,7 +1263,9 @@ async fn a_close_during_the_invite_mint_leaves_the_event_but_not_the_read() {
12631263
);
12641264

12651265
// The mint's one `await` is held, which is the window a `CLOSE` lands in.
1266-
fixture.invites.create_started().await;
1266+
tokio::time::timeout(Duration::from_secs(5), fixture.invites.create_started())
1267+
.await
1268+
.expect("the invite mint starts within five seconds");
12671269

12681270
assert_eq!(
12691271
fixture.invites.creates_started(),

0 commit comments

Comments
 (0)