Skip to content

Commit

Permalink
remove prune for broker topics
Browse files Browse the repository at this point in the history
  • Loading branch information
rob-maron committed May 7, 2024
1 parent 3e7960d commit 5244280
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions cdn-broker/src/tasks/broker/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::{sync::Arc, time::Duration};
use cdn_proto::{
authenticate_with_broker, bail,
connection::{auth::broker::BrokerAuth, protocols::Connection as _, Bytes, UserPublicKey},
def::{Connection, RunDef, Topic as _},
def::{Connection, RunDef},
discovery::BrokerIdentifier,
error::{Error, Result},
message::{Message, Topic},
Expand Down Expand Up @@ -131,28 +131,20 @@ impl<Def: RunDef> Inner<Def> {

// If we receive a broadcast message from a broker, we want to send it to all interested users
Message::Broadcast(ref broadcast) => {
// Get and prune the topics
let mut topics = broadcast.topics.clone();
Def::Topic::prune(&mut topics)?;
let topics = broadcast.topics.clone();

self.handle_broadcast_message(&topics, &raw_message, true);
}

// If we receive a subscribe message from a broker, we add them as "interested" locally.
Message::Subscribe(mut subscribe) => {
// Prune the topics
Def::Topic::prune(&mut subscribe)?;

Message::Subscribe(subscribe) => {
self.connections
.write()
.subscribe_broker_to(broker_identifier, subscribe);
}

// If we receive a subscribe message from a broker, we remove them as "interested" locally.
Message::Unsubscribe(mut unsubscribe) => {
// Prune the topics
Def::Topic::prune(&mut unsubscribe)?;

Message::Unsubscribe(unsubscribe) => {
self.connections
.write()
.unsubscribe_broker_from(broker_identifier, &unsubscribe);
Expand Down

0 comments on commit 5244280

Please sign in to comment.