Skip to content

Commit 011b88e

Browse files
loganjLarryclaude
committed
style(relay): format the claim calls rebased onto per-filter scopes
Rebasing onto main's per-filter live scopes (#8519) lengthened the claim_admitted_live calls; rustfmt now wraps them. Co-authored-by: Larry <627498bd4bd1f281a16431e3c6cce3b5c25b6692798c78672298aefbf2f8f8b5@buzz.block.builderlab.xyz> Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Logan Johnson <[email protected]>
1 parent 8d84ac9 commit 011b88e

1 file changed

Lines changed: 37 additions & 14 deletions

File tree

  • crates/buzz-relay/src/handlers

‎crates/buzz-relay/src/handlers/req.rs‎

Lines changed: 37 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -525,8 +525,7 @@ pub async fn handle_admitted_req(
525525
)
526526
})
527527
.collect();
528-
let Some(owner) = claim_admitted_live(&sub_id, owner, live_filters, &conn, &state).await
529-
else {
528+
let Some(owner) = claim_admitted_live(&sub_id, owner, live_filters, &conn, &state).await else {
530529
return;
531530
};
532531

@@ -1762,9 +1761,9 @@ pub(crate) async fn claim_live_subscription(
17621761
/// lock: register for fan-out (replacing any same-ID entry), retain its
17631762
/// topics, and release the replaced scope's. Each filter carries its own
17641763
/// server-resolved live scope; the subscription retains each topic in their
1765-
/// union once. Returns `owner`, or `None` once
1766-
/// the connection is closing or a newer same-ID REQ or a `CLOSE` superseded
1767-
/// this request — the caller then exits silently.
1764+
/// union once. Returns `owner`, or `None` once the connection is closing or a
1765+
/// newer same-ID REQ or a `CLOSE` superseded this request — the caller then
1766+
/// exits silently.
17681767
pub(crate) async fn claim_admitted_live(
17691768
sub_id: &str,
17701769
owner: u64,
@@ -2824,8 +2823,14 @@ mod tests {
28242823
assert_eq!(token(&conn, "x").await, Some(pending));
28252824
assert!(closed_frames(&mut send_rx).is_empty());
28262825

2827-
let claimed =
2828-
claim_admitted_live("x", pending, scoped(&text_filters(), Some(&[b])), &conn, &state).await;
2826+
let claimed = claim_admitted_live(
2827+
"x",
2828+
pending,
2829+
scoped(&text_filters(), Some(&[b])),
2830+
&conn,
2831+
&state,
2832+
)
2833+
.await;
28292834
assert_eq!(claimed, Some(pending));
28302835
assert!(subscribed(&state, &conn, b));
28312836
assert_eq!(refcount(b).await, 1);
@@ -2851,20 +2856,38 @@ mod tests {
28512856

28522857
let older = super::super::close::admit("x", &conn).await.expect("admit");
28532858
let newer = super::super::close::admit("x", &conn).await.expect("admit");
2854-
claim_admitted_live("x", newer, scoped(&text_filters(), Some(&[b])), &conn, &state)
2855-
.await
2856-
.expect("the newest request claims");
2857-
let stale =
2858-
claim_admitted_live("x", older, scoped(&text_filters(), Some(&[a])), &conn, &state).await;
2859+
claim_admitted_live(
2860+
"x",
2861+
newer,
2862+
scoped(&text_filters(), Some(&[b])),
2863+
&conn,
2864+
&state,
2865+
)
2866+
.await
2867+
.expect("the newest request claims");
2868+
let stale = claim_admitted_live(
2869+
"x",
2870+
older,
2871+
scoped(&text_filters(), Some(&[a])),
2872+
&conn,
2873+
&state,
2874+
)
2875+
.await;
28592876
assert_eq!(stale, None);
28602877
assert_eq!(token(&conn, "x").await, Some(newer));
28612878
assert!(subscribed(&state, &conn, b) && !subscribed(&state, &conn, a));
28622879
assert_eq!((refcount(a).await, refcount(b).await), (0, 1));
28632880

28642881
let pending = super::super::close::admit("y", &conn).await.expect("admit");
28652882
super::super::close::handle_close("y".into(), Arc::clone(&conn), Arc::clone(&state)).await;
2866-
let late =
2867-
claim_admitted_live("y", pending, scoped(&text_filters(), Some(&[a])), &conn, &state).await;
2883+
let late = claim_admitted_live(
2884+
"y",
2885+
pending,
2886+
scoped(&text_filters(), Some(&[a])),
2887+
&conn,
2888+
&state,
2889+
)
2890+
.await;
28682891
let late_search = claim_admitted_search("y", pending, &conn, &state).await;
28692892
assert_eq!((late, late_search), (None, None));
28702893
assert!(!registered(&state, &conn, "y"));

0 commit comments

Comments
 (0)