mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 06:53:25 +00:00
Simplify callback protocol for register_json_consumer().
The register_json_consumer() function now expects its callback
function to accept a single argument, which is the payload, as
none of the callbacks cared about channel, method, and properties.
This change breaks down as follows:
* A couple test stubs and subclasses were simplified.
* All the consume() and consume_wrapper() functions in
queue_processors.py were simplified.
* Two callbacks via runtornado.py were simplified. One
of the callbacks was socket.respond_send_message, which
had an additional caller, i.e. not register_json_consumer()
calling back to it, and the caller was simplified not
to pass None for the three removed arguments.
(imported from commit 792316e20be619458dd5036745233f37e6ffcf43)
This commit is contained in:
@@ -110,7 +110,7 @@ class SimpleQueueClient(object):
|
||||
|
||||
def register_json_consumer(self, queue_name, callback):
|
||||
def wrapped_callback(ch, method, properties, body):
|
||||
return callback(ch, method, properties, ujson.loads(body))
|
||||
return callback(ujson.loads(body))
|
||||
return self.register_consumer(queue_name, wrapped_callback)
|
||||
|
||||
def drain_queue(self, queue_name, json=False):
|
||||
|
||||
Reference in New Issue
Block a user