replication: Allow databases_per_second to be a float
Sometimes even one database per second is too fast. Change-Id: Iaf11743485e1ad320c82476430f450be0c4f849c Closes-Bug: #1877827
This commit is contained in:
parent
08db36a295
commit
971023e4c8
@ -205,7 +205,7 @@ class Replicator(Daemon):
|
|||||||
' to use option %(type)s-replicator/'
|
' to use option %(type)s-replicator/'
|
||||||
'interval.'
|
'interval.'
|
||||||
% {'type': self.server_type})
|
% {'type': self.server_type})
|
||||||
self.databases_per_second = int(
|
self.databases_per_second = float(
|
||||||
conf.get('databases_per_second', 50))
|
conf.get('databases_per_second', 50))
|
||||||
self.node_timeout = float(conf.get('node_timeout', 10))
|
self.node_timeout = float(conf.get('node_timeout', 10))
|
||||||
self.conn_timeout = float(conf.get('conn_timeout', 0.5))
|
self.conn_timeout = float(conf.get('conn_timeout', 0.5))
|
||||||
|
@ -324,7 +324,11 @@ class TestDBReplicator(unittest.TestCase):
|
|||||||
# later config should be extended to assert more config options
|
# later config should be extended to assert more config options
|
||||||
replicator = TestReplicator({'node_timeout': '3.5'})
|
replicator = TestReplicator({'node_timeout': '3.5'})
|
||||||
self.assertEqual(replicator.node_timeout, 3.5)
|
self.assertEqual(replicator.node_timeout, 3.5)
|
||||||
self.assertEqual(replicator.databases_per_second, 50)
|
self.assertEqual(replicator.databases_per_second, 50.0)
|
||||||
|
|
||||||
|
replicator = TestReplicator({'databases_per_second': '0.1'})
|
||||||
|
self.assertEqual(replicator.node_timeout, 10)
|
||||||
|
self.assertEqual(replicator.databases_per_second, 0.1)
|
||||||
|
|
||||||
def test_repl_connection(self):
|
def test_repl_connection(self):
|
||||||
node = {'replication_ip': '127.0.0.1', 'replication_port': 80,
|
node = {'replication_ip': '127.0.0.1', 'replication_port': 80,
|
||||||
|
Loading…
Reference in New Issue
Block a user