Skip to content

Commit

Permalink
fix: restore topic unsubscribe
Browse files Browse the repository at this point in the history
  • Loading branch information
chris13524 committed Jan 29, 2024
1 parent 28fbd10 commit 10ba989
Showing 1 changed file with 14 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ use {
base64::Engine,
chrono::Utc,
relay_rpc::{
domain::{DecodedClientId, Topic},
domain::{DecodedClientId, SubscriptionId, Topic},
rpc::Publish,
},
std::{collections::HashSet, sync::Arc},
tracing::info,
tracing::{info, warn},
};

// TODO make and test idempotency
Expand Down Expand Up @@ -145,14 +145,18 @@ pub async fn handle(msg: RelayIncomingMessage, state: &AppState) -> Result<(), R
.await
.map_err(RelayMessageServerError::NotifyServerError)?; // TODO change to client error?

// FIXME cannot unsubscribe without subscription_id
// if let Err(e) = state
// .relay_client
// .unsubscribe(topic.clone(), msg.subscription_id)
// .await
// {
// warn!("Error unsubscribing Notify from topic: {}", e);
// };
tokio::task::spawn({
let relay_client = state.relay_client.clone();
let topic = topic.clone();
async move {
// Relay ignores subscription_id, generate a random one since we don't have it here.
// https://walletconnect.slack.com/archives/C05ABTQSPFY/p1706337410799659?thread_ts=1706307603.828609&cid=C05ABTQSPFY
let subscription_id = SubscriptionId::generate();
if let Err(e) = relay_client.unsubscribe(topic, subscription_id).await {
warn!("Error unsubscribing Notify from topic: {}", e);
}
}
});

state.analytics.client(SubscriberUpdateParams {
project_pk: project.id,
Expand Down

0 comments on commit 10ba989

Please sign in to comment.