DB: Load only one instance for RPC interactions
Load the database instance only once for all RPC interactions, as opposed to upon each time we try to find a random conductor. Change-Id: I917537f041e794fd3c94e0f2c48d25eb4351d4c8
This commit is contained in:
parent
461d85502d
commit
9516c67b61
@ -36,6 +36,8 @@ from ironic.objects import base as objects_base
|
||||
|
||||
LOG = log.getLogger(__name__)
|
||||
|
||||
DBAPI = dbapi.get_instance()
|
||||
|
||||
|
||||
class LocalContext:
|
||||
"""Context to make calls to a local conductor."""
|
||||
@ -248,7 +250,7 @@ class ConductorAPI(object):
|
||||
|
||||
def get_random_topic(self):
|
||||
"""Get an RPC topic for a random conductor service."""
|
||||
conductors = dbapi.get_instance().get_online_conductors()
|
||||
conductors = DBAPI.get_online_conductors()
|
||||
try:
|
||||
hostname = random.choice(conductors)
|
||||
except IndexError:
|
||||
|
Loading…
x
Reference in New Issue
Block a user