2

I'm working with python2.7 and pika 0.10.0 and trying to understand how to use pika.adapters.blocking_connection.BlockingConnection.process_data_events . From the doc:

Will make sure that data events are processed. Dispatches timer and channel callbacks if not called from the scope of BlockingConnection or BlockingChannel callback. Your app can block on this method.

If we also look at the parameter:

Parameters: time_limit (float) – suggested upper bound on processing time in seconds. The actual blocking time depends on the granularity of the underlying ioloop. Zero means return as soon as possible. None means there is no limit on processing time and the function will block until I/O produces actionalable events. Defaults to 0 for backward compatibility. This parameter is NEW in pika 0.10.0.

My understanding is that calling process_data_events(time_limit=2) will block for up to 2 seconds, and if in the meanwhile an event occur (e.g. we receive a message on a channel) that event will be processed; if the callback which is called in response to that event takes more than 2 seconds, it will run to completion and process_data_events(time_limit=2) will return, possible after 2 seconds.

Is the correct behaviour?

Lorenzo Belli
  • 1,767
  • 4
  • 25
  • 46
  • I took a glance at pika source, don't think it has the ability to limit callback execution time. – georgexsh Nov 17 '17 at 12:20
  • [related](https://stackoverflow.com/questions/46053349/keep-pika-blockingconnection-alive-without-disabling-heartbeat/46866508#46866508) – Lorenzo Belli Feb 02 '18 at 10:55

0 Answers0