From 187787425addef9dfd8a374aa0e3a44a08975218 Mon Sep 17 00:00:00 2001
From: Einar Forselv <eforselv@gmail.com>
Date: Sun, 8 Dec 2019 01:16:10 +0100
Subject: [PATCH] Sane default buffer size in backup_from_stdin

---
 src/restic_compose_backup/restic.py | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/src/restic_compose_backup/restic.py b/src/restic_compose_backup/restic.py
index 11fb760..c1b2410 100644
--- a/src/restic_compose_backup/restic.py
+++ b/src/restic_compose_backup/restic.py
@@ -40,11 +40,8 @@ def backup_from_stdin(repository: str, filename: str, source_command: List[str])
     ])
 
     # pipe source command into dest command
-    # NOTE: Using the default buffer size: io.DEFAULT_BUFFER_SIZE = 8192
-    #       We might want to tweak that to speed up large dumps.
-    #       Actual tests tests must be done.
-    source_process = Popen(source_command, stdout=PIPE)
-    dest_process = Popen(dest_command, stdin=source_process.stdout, stdout=PIPE, stderr=PIPE)
+    source_process = Popen(source_command, stdout=PIPE, bufsize=65536)
+    dest_process = Popen(dest_command, stdin=source_process.stdout, stdout=PIPE, stderr=PIPE, bufsize=65536)
     stdout, stderr = dest_process.communicate()
 
     # Ensure both processes exited with code 0