Remove conditional blocking on server list
When the server list cache proceduce was imported from nodepool, it grew this internal conditional which caused all server list calls to block on aquiring the server list cache update lock iff the server list cache is empty. This means that on startup, we could have a thundering herd of threads which all insisted on waiting for the lock because there was no cached server list. This does not seem to be necessary, and the original nodepool logic of always performing non-blocking acquisitions of the lock and returning the old (possibly empty) list of servers for any thread that did not get the lock (but will try again a few seconds later and should receive updated data at that time) should be sufficient. Change-Id: I5640f60da2b7789a98bea033e16695389c6062e0
This commit is contained in:
@@ -1150,9 +1150,7 @@ class OpenStackCloud(object):
|
||||
# a lock, and the non-blocking acquire method will cause
|
||||
# subsequent threads to just skip this and use the old
|
||||
# data until it succeeds.
|
||||
# For the first time, when there is no data, make the call
|
||||
# blocking.
|
||||
if self._ports_lock.acquire(len(self._ports) == 0):
|
||||
if self._ports_lock.acquire(False):
|
||||
try:
|
||||
self._ports = self._list_ports(filters)
|
||||
self._ports_time = time.time()
|
||||
@@ -1270,9 +1268,7 @@ class OpenStackCloud(object):
|
||||
# a lock, and the non-blocking acquire method will cause
|
||||
# subsequent threads to just skip this and use the old
|
||||
# data until it succeeds.
|
||||
# For the first time, when there is no data, make the call
|
||||
# blocking.
|
||||
if self._servers_lock.acquire(len(self._servers) == 0):
|
||||
if self._servers_lock.acquire(False):
|
||||
try:
|
||||
self._servers = self._list_servers(detailed=detailed)
|
||||
self._servers_time = time.time()
|
||||
|
||||
Reference in New Issue
Block a user