Ver Fonte

:bug: fix callback lambda name

Jeremy Zheng há 9 meses atrás
pai
commit
5c4dfa96ee
1 ficheiros alterados com 2 adições e 2 exclusões
  1. 2 2
      ai-translate/ai_translate/__init__.py

+ 2 - 2
ai-translate/ai_translate/__init__.py

@@ -31,7 +31,7 @@ def start_consumer(context, name, config, queue, callback):
             virtual_host=config['virtual-host']))
     channel = connection.channel()
 
-    def callback(ch, method, properties, body):
+    def _callback(ch, method, properties, body):
         logger.info("received message(%s,%s)",
                     properties.message_id, properties.content_type)
         handle_message(context, ch, method, properties.message_id,
@@ -40,7 +40,7 @@ def start_consumer(context, name, config, queue, callback):
                        callback, ['customer-timeout'])
 
     channel.basic_consume(
-        queue=queue, on_message_callback=callback, auto_ack=False)
+        queue=queue, on_message_callback=_callback, auto_ack=False)
 
     logger.info('start a consumer(%s) for queue(%s)', name, queue)
     channel.start_consuming()