mirror of
https://github.com/uqbar-dao/nectar.git
synced 2024-11-27 18:55:29 +03:00
hotfix2: overwrite existing subscription if ID is reused
This commit is contained in:
parent
7d01dcfcae
commit
74f8fda9ce
@ -119,9 +119,9 @@ async fn handle_request(
|
|||||||
match action {
|
match action {
|
||||||
EthAction::SubscribeLogs { sub_id, filter } => {
|
EthAction::SubscribeLogs { sub_id, filter } => {
|
||||||
let sub_id = (target.process.clone(), sub_id);
|
let sub_id = (target.process.clone(), sub_id);
|
||||||
if connections.ws_provider_subscriptions.contains_key(&sub_id) {
|
|
||||||
return Err(EthError::SubscriptionIdCollision);
|
// if this process has already used this subscription ID,
|
||||||
}
|
// this subscription will **overwrite** the existing one.
|
||||||
|
|
||||||
let handle = tokio::spawn(handle_subscription_stream(
|
let handle = tokio::spawn(handle_subscription_stream(
|
||||||
our.clone(),
|
our.clone(),
|
||||||
|
@ -23,8 +23,6 @@ pub enum EthAction {
|
|||||||
/// and `serde_json::from_slice`.
|
/// and `serde_json::from_slice`.
|
||||||
#[derive(Debug, Serialize, Deserialize)]
|
#[derive(Debug, Serialize, Deserialize)]
|
||||||
pub enum EthError {
|
pub enum EthError {
|
||||||
/// The subscription ID already existed
|
|
||||||
SubscriptionIdCollision,
|
|
||||||
/// The ethers provider threw an error when trying to subscribe
|
/// The ethers provider threw an error when trying to subscribe
|
||||||
/// (contains ProviderError serialized to debug string)
|
/// (contains ProviderError serialized to debug string)
|
||||||
ProviderError(String),
|
ProviderError(String),
|
||||||
|
Loading…
Reference in New Issue
Block a user