You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by GitBox <gi...@apache.org> on 2021/05/27 17:30:07 UTC

[GitHub] [qpid-dispatch] kgiusti commented on a change in pull request #1232: DISPATCH-1757: Added code to print out sender stats so we can see wha…

kgiusti commented on a change in pull request #1232:
URL: https://github.com/apache/qpid-dispatch/pull/1232#discussion_r640828521



##########
File path: tests/system_test.py
##########
@@ -1013,8 +1018,16 @@ def on_link_closing(self, event):
             rcv = event.container.create_receiver(event.connection,
                                                   **kwargs)
 
+    def queue_put(self, msg):

Review comment:
       You can avoid changing the API (and all those other files) by creating an internal class to the AsyncTestReceiver that inherits from Queue and overrides get() and put() to do what you want.
   
   Something like:
   
   class _MyQueue(Queue):                                                                                                                            
      def __init__(self, receiver):                                                                                                                  
          self._async_receiver = receiver                                                                                                            
          super(_MyQueue, self).__init__()                                                                                                           
                                                                                                                                                     
      def get(self, timeout=TIMEOUT):                                                                                                                
          self._async_receiver.num_queue_gets +=1                                                                                                    
          super(_MyQueue, self).get(timeout)                                                                                                         
                                                                                                                                                     
      def put(self, msg):                                                                                                                            
          self._async_receiver.num_queue_puts +=1                                                                                                    
          super(_MyQueue, self).put(msg)                                                                                                             
                                                                                                                                                     
                                                                                                                                                     
   then in the async receiver's __init__:                                                                                                
       self.queue = _MyQueue(self)
   
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org