obj: Include timeout value when logging long-running rsyncs

Change-Id: I5f319ce7842152d0cd367559a6108407acd65cc0
This commit is contained in:
Tim Burke 2021-01-19 10:43:39 -08:00
parent 14a42d573a
commit e318d15b8e
2 changed files with 5 additions and 4 deletions

View File

@ -385,7 +385,8 @@ class ObjectReplicator(Daemon):
except Timeout:
self.logger.error(
self._limit_rsync_log(
_("Killing long-running rsync: %s") % str(args)))
_("Killing long-running rsync after %ds: %s") % (
self.rsync_timeout, str(args))))
if proc:
proc.kill()
try:

View File

@ -2147,7 +2147,7 @@ class TestObjectReplicator(unittest.TestCase):
mock_http_connect(200)), \
mock.patch.object(self.replicator, 'rsync_timeout', 0.01), \
mock.patch('eventlet.green.subprocess.Popen', new_mock):
self.replicator.rsync_error_log_line_length = 20
self.replicator.rsync_error_log_line_length = 40
self.replicator.run_once()
for proc in mock_procs:
self.assertEqual(proc._calls, [
@ -2158,8 +2158,8 @@ class TestObjectReplicator(unittest.TestCase):
self.assertEqual(len(mock_procs), 2)
error_lines = self.replicator.logger.get_lines_for_level('error')
# verify logs are truncated to rsync_error_log_line_length
self.assertEqual('Killing long-running', error_lines[0])
self.assertEqual('Killing long-running', error_lines[1])
self.assertEqual(["Killing long-running rsync after 0s: ['r"] * 2,
error_lines)
def test_replicate_rsync_timeout_wedged(self):
cur_part = '0'