Merge "setting request_node_count doesn't work"
This commit is contained in:
commit
7a24c4ba3a
@ -139,11 +139,11 @@ class Application(object):
|
||||
conf.get('max_large_object_get_time', '86400'))
|
||||
value = conf.get('request_node_count', '2 * replicas').lower().split()
|
||||
if len(value) == 1:
|
||||
value = int(value[0])
|
||||
self.request_node_count = lambda replicas: value
|
||||
rnc_value = int(value[0])
|
||||
self.request_node_count = lambda replicas: rnc_value
|
||||
elif len(value) == 3 and value[1] == '*' and value[2] == 'replicas':
|
||||
value = int(value[0])
|
||||
self.request_node_count = lambda replicas: value * replicas
|
||||
rnc_value = int(value[0])
|
||||
self.request_node_count = lambda replicas: rnc_value * replicas
|
||||
else:
|
||||
raise ValueError(
|
||||
'Invalid request_node_count value: %r' % ''.join(value))
|
||||
@ -165,11 +165,12 @@ class Application(object):
|
||||
value = conf.get('write_affinity_node_count',
|
||||
'2 * replicas').lower().split()
|
||||
if len(value) == 1:
|
||||
value = int(value[0])
|
||||
self.write_affinity_node_count = lambda replicas: value
|
||||
wanc_value = int(value[0])
|
||||
self.write_affinity_node_count = lambda replicas: wanc_value
|
||||
elif len(value) == 3 and value[1] == '*' and value[2] == 'replicas':
|
||||
value = int(value[0])
|
||||
self.write_affinity_node_count = lambda replicas: value * replicas
|
||||
wanc_value = int(value[0])
|
||||
self.write_affinity_node_count = \
|
||||
lambda replicas: wanc_value * replicas
|
||||
else:
|
||||
raise ValueError(
|
||||
'Invalid write_affinity_node_count value: %r' % ''.join(value))
|
||||
|
@ -1779,6 +1779,14 @@ class TestObjectController(unittest.TestCase):
|
||||
resp = req.get_response(self.app)
|
||||
self.assertEquals(resp.status_int, 503)
|
||||
|
||||
def test_node_request_setting(self):
|
||||
baseapp = proxy_server.Application({'request_node_count': '3'},
|
||||
FakeMemcache(),
|
||||
container_ring=FakeRing(),
|
||||
account_ring=FakeRing(),
|
||||
object_ring=FakeRing())
|
||||
self.assertEquals(baseapp.request_node_count(3), 3)
|
||||
|
||||
def test_iter_nodes(self):
|
||||
with save_globals():
|
||||
try:
|
||||
|
Loading…
Reference in New Issue
Block a user