Fix SSYNC/missing_check is blocking

Change-Id: I9979504b475a731f316960b497056b2824655c6f
This commit is contained in:
Romain LE DISEZ 2019-09-23 14:57:45 -04:00
parent 712bf3c9fb
commit 3fe9b582ef
1 changed files with 5 additions and 0 deletions

View File

@ -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)