Skip to content

Commit

Permalink
Amends #407 to properly fix the issue (#410)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaka authored Apr 11, 2023
1 parent cf83624 commit 2cef4f7
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 6 deletions.
30 changes: 25 additions & 5 deletions light-base/src/json_rpc_service/background/state_chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,11 @@ impl<TPlat: Platform> Background<TPlat> {
)
.await;

let requests_subscriptions = Arc::downgrade(&requests_subscriptions);
let requests_subscriptions = {
let weak = Arc::downgrade(&requests_subscriptions);
drop(requests_subscriptions);
weak
};

'main_sub_loop: loop {
let mut new_blocks = {
Expand Down Expand Up @@ -583,7 +587,11 @@ impl<TPlat: Platform> Background<TPlat> {
)
.await;

let requests_subscriptions = Arc::downgrade(&requests_subscriptions);
let requests_subscriptions = {
let weak = Arc::downgrade(&requests_subscriptions);
drop(requests_subscriptions);
weak
};

loop {
let event = {
Expand Down Expand Up @@ -713,7 +721,11 @@ impl<TPlat: Platform> Background<TPlat> {
)
.await;

let requests_subscriptions = Arc::downgrade(&requests_subscriptions);
let requests_subscriptions = {
let weak = Arc::downgrade(&requests_subscriptions);
drop(requests_subscriptions);
weak
};

loop {
let event = {
Expand Down Expand Up @@ -1428,7 +1440,11 @@ impl<TPlat: Platform> Background<TPlat> {
let spec_changes = stream::iter(iter::once(current_spec)).chain(spec_changes);
futures::pin_mut!(spec_changes);

let requests_subscriptions = Arc::downgrade(&requests_subscriptions);
let requests_subscriptions = {
let weak = Arc::downgrade(&requests_subscriptions);
drop(requests_subscriptions);
weak
};

loop {
let event = {
Expand Down Expand Up @@ -1687,7 +1703,11 @@ impl<TPlat: Platform> Background<TPlat> {

futures::pin_mut!(storage_updates);

let requests_subscriptions = Arc::downgrade(&requests_subscriptions);
let requests_subscriptions = {
let weak = Arc::downgrade(&requests_subscriptions);
drop(requests_subscriptions);
weak
};

loop {
let event = {
Expand Down
6 changes: 5 additions & 1 deletion light-base/src/json_rpc_service/background/transactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,11 @@ impl<TPlat: Platform> Background<TPlat> {

// TODO: doesn't reported `validated` events

let requests_subscriptions = Arc::downgrade(&requests_subscriptions);
let requests_subscriptions = {
let weak = Arc::downgrade(&requests_subscriptions);
drop(requests_subscriptions);
weak
};

loop {
let event = {
Expand Down

0 comments on commit 2cef4f7

Please sign in to comment.