Raise timeout in fake RPC if no consumers found

If you do a call() with e.g. the kombu driver, and there is no consumer
listening, then you will get a Timeout exception.

However, with the fake driver, we just silently return None in this
case. The oslo.messaging fake driver instead raises a Timeout and this
behaviour change turned up a tonne of issues with Nova's unit tests.

Make this change here too so that we can merge fixes for Nova's tests
before porting to oslo.messaging.

Note that although we also raise a Timeout in the case of cast(), but
cast() then just ignores the exception.

This commit just syncs this change from oslo-incubator.

blueprint: oslo-messaging
Change-Id: I20065bcc61dda99a68143afbcf6bb96884b6eb91
This commit is contained in:
Mark McLoughlin
2013-08-19 13:18:20 +01:00
parent ab6adb51ef
commit e2105bb7c6

View File

@@ -146,7 +146,7 @@ def multicall(conf, context, topic, msg, timeout=None):
try:
consumer = CONSUMERS[topic][0]
except (KeyError, IndexError):
return iter([None])
raise rpc_common.Timeout("No consumers available")
else:
return consumer.call(context, version, method, namespace, args,
timeout)