diff options
-rw-r--r-- | swift/obj/ssync_receiver.py | 4 | ||||
-rw-r--r-- | swift/obj/ssync_sender.py | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/swift/obj/ssync_receiver.py b/swift/obj/ssync_receiver.py index 762556b82..54f70e862 100644 --- a/swift/obj/ssync_receiver.py +++ b/swift/obj/ssync_receiver.py @@ -445,6 +445,7 @@ class Receiver(object): raise Exception('Looking for :UPDATES: START got %r' % line[:1024]) successes = 0 failures = 0 + updates = 0 while True: line = self._readline('updates line') if not line or line.strip() == b':UPDATES: END': @@ -539,6 +540,9 @@ class Receiver(object): # subreq. for junk in subreq.environ['wsgi.input']: pass + if updates % 5 == 0: + sleep() # Gives a chance for other greenthreads to run + updates += 1 if failures: raise swob.HTTPInternalServerError( 'ERROR: With :UPDATES: %d failures to %d successes' % diff --git a/swift/obj/ssync_sender.py b/swift/obj/ssync_sender.py index 23eb2f86b..9df2d123a 100644 --- a/swift/obj/ssync_sender.py +++ b/swift/obj/ssync_sender.py @@ -359,6 +359,7 @@ class Sender(object): msg = b':UPDATES: START\r\n' connection.send(b'%x\r\n%s\r\n' % (len(msg), msg)) frag_prefs = [] if self.include_non_durable else None + updates = 0 for object_hash, want in send_map.items(): object_hash = urllib.parse.unquote(object_hash) try: @@ -394,6 +395,9 @@ class Sender(object): # continue. The diskfile may however be deleted after a # successful ssync since it remains in the send_map. pass + if updates % 5 == 0: + sleep() # Gives a chance for other greenthreads to run + updates += 1 with exceptions.MessageTimeout( self.daemon.node_timeout, 'updates end'): msg = b':UPDATES: END\r\n' |