hotfix2: overwrite existing subscription if ID is reused

This commit is contained in:
dr-frmr 2024-01-25 22:58:54 -03:00
parent 7d01dcfcae
commit 74f8fda9ce
No known key found for this signature in database
2 changed files with 3 additions and 5 deletions

View File

@ -119,9 +119,9 @@ async fn handle_request(
match action {
EthAction::SubscribeLogs { sub_id, filter } => {
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(
our.clone(),

View File

@ -23,8 +23,6 @@ pub enum EthAction {
/// and `serde_json::from_slice`.
#[derive(Debug, Serialize, Deserialize)]
pub enum EthError {
/// The subscription ID already existed
SubscriptionIdCollision,
/// The ethers provider threw an error when trying to subscribe
/// (contains ProviderError serialized to debug string)
ProviderError(String),