mirror of
https://github.com/uqbar-dao/nectar.git
synced 2024-11-23 03:44:04 +03:00
eth: avoid ws provider race condition by checking before replacing
This commit is contained in:
parent
b4813e4fdd
commit
2259449321
6
Cargo.lock
generated
6
Cargo.lock
generated
@ -3203,7 +3203,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "kinode"
|
||||
version = "0.8.6"
|
||||
version = "0.8.7"
|
||||
dependencies = [
|
||||
"aes-gcm",
|
||||
"alloy",
|
||||
@ -3259,7 +3259,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "kinode_lib"
|
||||
version = "0.8.6"
|
||||
version = "0.8.7"
|
||||
dependencies = [
|
||||
"lib",
|
||||
]
|
||||
@ -3376,7 +3376,7 @@ checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67"
|
||||
|
||||
[[package]]
|
||||
name = "lib"
|
||||
version = "0.8.6"
|
||||
version = "0.8.7"
|
||||
dependencies = [
|
||||
"alloy",
|
||||
"kit",
|
||||
|
@ -626,8 +626,11 @@ async fn fulfill_request(
|
||||
is_replacement_successful = false;
|
||||
return ();
|
||||
};
|
||||
aps.urls.remove(index);
|
||||
aps.urls.insert(0, url_provider.clone());
|
||||
let old_provider = aps.urls.remove(index);
|
||||
match old_provider.pubsub {
|
||||
None => aps.urls.insert(0, url_provider.clone()),
|
||||
Some(_) => aps.urls.insert(0, old_provider),
|
||||
}
|
||||
});
|
||||
if !is_replacement_successful {
|
||||
verbose_print(
|
||||
|
@ -232,8 +232,12 @@ async fn build_subscription(
|
||||
is_replacement_successful = false;
|
||||
return ();
|
||||
};
|
||||
aps.urls.remove(index);
|
||||
aps.urls.insert(0, url_provider.clone());
|
||||
let old_provider = aps.urls.remove(index);
|
||||
match old_provider.pubsub {
|
||||
None => aps.urls.insert(0, url_provider.clone()),
|
||||
Some(_) => aps.urls.insert(0, old_provider),
|
||||
}
|
||||
|
||||
});
|
||||
if !is_replacement_successful {
|
||||
verbose_print(
|
||||
|
Loading…
Reference in New Issue
Block a user