Ver código fonte

Remove read/write locks

Remove a read lock to check and avoid two consecutive write locks.
Cesar Rodas 2 anos atrás
pai
commit
71b41d053c

+ 1 - 0
src/connection/pubsub_connection.rs

@@ -102,6 +102,7 @@ impl PubsubClient {
     /// Creates a new pattern subscription
     pub fn new_psubscription(&self, channel: &Pattern) {
         let mut meta = self.meta.write();
+        meta.is_psubcribed = true;
         meta.psubscriptions.insert(channel.clone(), true);
     }
 

+ 0 - 4
src/connection/pubsub_server.rs

@@ -74,10 +74,6 @@ impl Pubsub {
                 h.insert(conn.id(), conn.pubsub_client().sender());
                 subscriptions.insert(channel.clone(), h);
             }
-            if !conn.pubsub_client().is_psubcribed() {
-                conn.pubsub_client().make_psubcribed();
-            }
-
             conn.pubsub_client().new_psubscription(&channel);
 
             conn.append_response(