From e46365184a41cebc32e90b5ceeac70873fc264ad Mon Sep 17 00:00:00 2001 From: Jake Poznanski Date: Fri, 18 Oct 2019 10:58:01 -0700 Subject: [PATCH] Stream data in order it was received When flushing, stream out the iterators in First in first out order. Python `pop()` with no arguments would take the last path but I think it makes sense to stream the first things first. We ran into this issue where we add a bunch of files which depend on long-running futures to provide the data. The futures hit a server which processes them roughly in order, so we get better streaming performance if we make this change. --- zipstream/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zipstream/__init__.py b/zipstream/__init__.py index 5d7accd..a086e3a 100644 --- a/zipstream/__init__.py +++ b/zipstream/__init__.py @@ -191,7 +191,7 @@ def __exit__(self, type, value, traceback): def flush(self): while self.paths_to_write: - kwargs = self.paths_to_write.pop() + kwargs = self.paths_to_write.pop(0) for data in self.__write(**kwargs): yield data