Skip to content

Commit bd94547

Browse files
committed
fix(put): preserve upstream during broadcast
1 parent 4ea1270 commit bd94547

File tree

1 file changed

+12
-1
lines changed
  • crates/core/src/operations

1 file changed

+12
-1
lines changed

crates/core/src/operations/put.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -885,6 +885,14 @@ async fn try_to_broadcast(
885885
_ => false,
886886
};
887887

888+
let preserved_upstream = match &state {
889+
Some(PutState::AwaitingResponse {
890+
upstream: Some(existing),
891+
..
892+
}) => Some(existing.clone()),
893+
_ => None,
894+
};
895+
888896
match state {
889897
// Handle initiating node that's also the target (single node or targeting self)
890898
Some(PutState::AwaitingResponse {
@@ -923,9 +931,12 @@ async fn try_to_broadcast(
923931
key
924932
);
925933
// means the whole tx finished so can return early
934+
let upstream_for_completion = preserved_upstream
935+
.clone()
936+
.or_else(|| Some(upstream.clone()));
926937
new_state = Some(PutState::AwaitingResponse {
927938
key,
928-
upstream: Some(upstream),
939+
upstream: upstream_for_completion,
929940
contract: contract.clone(), // No longer optional
930941
state: new_value.clone(),
931942
subscribe,

0 commit comments

Comments
 (0)