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:
Tim Burke 2020-05-15 13:23:17 -07:00
parent 08db36a295
commit 971023e4c8
2 changed files with 6 additions and 2 deletions

View File

@ -205,7 +205,7 @@ class Replicator(Daemon):
' to use option %(type)s-replicator/'
'interval.'
% {'type': self.server_type})
self.databases_per_second = int(
self.databases_per_second = float(
conf.get('databases_per_second', 50))
self.node_timeout = float(conf.get('node_timeout', 10))
self.conn_timeout = float(conf.get('conn_timeout', 0.5))

View File

@ -324,7 +324,11 @@ class TestDBReplicator(unittest.TestCase):
# later config should be extended to assert more config options
replicator = TestReplicator({'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):
node = {'replication_ip': '127.0.0.1', 'replication_port': 80,