Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion light-base/src/runtime_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1672,6 +1672,14 @@ async fn run_background<TPlat: PlatformRef>(
(tx, pending_subscription.max_pinned_blocks.get() - 1),
);

// The chain object can be dropped concurrently; if so, the
// weak reference no longer upgrades and the original task is
// shutting down. Drop the response silently rather than
// panicking, the receiver is going away anyway.
let Some(to_background) = background.to_background_tx.upgrade() else {
continue;
};

let _ = pending_subscription.result_tx.send(SubscribeAll {
finalized_block_scale_encoded_header: finalized_block
.scale_encoded_header
Expand All @@ -1686,7 +1694,7 @@ async fn run_background<TPlat: PlatformRef>(
new_blocks: Subscription {
subscription_id,
channel: Box::pin(new_blocks_channel),
to_background: background.to_background_tx.upgrade().unwrap(),
to_background,
},
});
}
Expand Down