Only take locks for socket transforms when necessary
authorJack Miller <jack@codezen.org>
Wed, 15 Jul 2015 02:26:20 +0000 (21:26 -0500)
committerJack Miller <jack@codezen.org>
Wed, 15 Jul 2015 02:31:49 +0000 (21:31 -0500)
canto_next/canto_backend.py

index b57f480..96cc140 100644 (file)
@@ -341,19 +341,21 @@ class CantoBackend(PluginHandler, CantoServer):
 
     # ITEMS [tags] -> { tag : [ ids ], tag2 : ... }
 
+    @read_lock(attr_lock)
     @read_lock(feed_lock)
     def _apply_socktrans(self, socket, tag):
         feeds = allfeeds.items_to_feeds(tag)
         rlock_feed_objs(feeds)
+        socktran_lock.acquire_read()
         try:
+
             for filt in self.socket_transforms[socket]:
                 tag = self.socket_transforms[socket][filt](tag)
         finally:
+            socktran_lock.release_read()
             runlock_feed_objs(feeds)
         return tag
 
-    @read_lock(attr_lock)
-    @read_lock(socktran_lock)
     def cmd_items(self, socket, args):
         ids = []
         response = {}