From 3fe9b582ef22b8f1a0fbff34b995d9fb2957140a Mon Sep 17 00:00:00 2001 From: Romain LE DISEZ Date: Mon, 23 Sep 2019 14:57:45 -0400 Subject: [PATCH] Fix SSYNC/missing_check is blocking Change-Id: I9979504b475a731f316960b497056b2824655c6f --- swift/obj/ssync_receiver.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/swift/obj/ssync_receiver.py b/swift/obj/ssync_receiver.py index a602d98a02..a3c1a49739 100644 --- a/swift/obj/ssync_receiver.py +++ b/swift/obj/ssync_receiver.py @@ -16,6 +16,7 @@ import eventlet.greenio import eventlet.wsgi +from eventlet import sleep from six.moves import urllib from swift.common import exceptions @@ -341,6 +342,7 @@ class Receiver(object): raise Exception( 'Looking for :MISSING_CHECK: START got %r' % line[:1024]) object_hashes = [] + nlines = 0 while True: with exceptions.MessageTimeout( self.app.client_timeout, 'missing_check line'): @@ -350,6 +352,9 @@ class Receiver(object): want = self._check_missing(line) if want: object_hashes.append(want) + if nlines % 5 == 0: + sleep() # Gives a chance for other greenthreads to run + nlines += 1 yield b':MISSING_CHECK: START\r\n' if object_hashes: yield b'\r\n'.join(hsh.encode('ascii') for hsh in object_hashes)