diff --git a/util/gzipstream.py b/util/gzipstream.py index e4f39c6da..0f9ce1e6b 100644 --- a/util/gzipstream.py +++ b/util/gzipstream.py @@ -3,6 +3,7 @@ Defines utility methods for working with gzip streams. """ import zlib +import time # Window size for decompressing GZIP streams. # This results in ZLIB automatically detecting the GZIP headers. @@ -35,4 +36,8 @@ def calculate_size_handler(): size_info.uncompressed_size += len(decompressor.decompress(current_data, CHUNK_SIZE)) current_data = decompressor.unconsumed_tail + # Make sure we allow the scheduler to do other work if we get stuck in this tight loop. + if len(current_data) > 0: + time.sleep(0) + return size_info, fn