extend, not append
This commit is contained in:
parent
6be4f57a49
commit
202e2e391f
@ -404,9 +404,8 @@ def main():
|
||||
import_args += [archive_name, "-"]
|
||||
logger.debug("%s", {"import_args": import_args, "env": env})
|
||||
|
||||
try:
|
||||
|
||||
def download_iter():
|
||||
try:
|
||||
offset = 0
|
||||
retries = 10
|
||||
while True:
|
||||
@ -416,6 +415,9 @@ def main():
|
||||
backup.creation,
|
||||
backup.version_id,
|
||||
)
|
||||
if download:
|
||||
download.close()
|
||||
download.release_conn()
|
||||
download = minio.get_object(
|
||||
bucket_name="gitlab-backups",
|
||||
object_name=backup.filename,
|
||||
@ -443,6 +445,9 @@ def main():
|
||||
raise e
|
||||
retries -= 1
|
||||
sleep(uniform(0, 10))
|
||||
finally:
|
||||
download.close()
|
||||
download.release_conn()
|
||||
|
||||
download_stream = download_iter()
|
||||
|
||||
@ -469,17 +474,11 @@ def main():
|
||||
)
|
||||
poll.register(
|
||||
proc.stdout,
|
||||
select.POLLIN
|
||||
| select.POLLPRI
|
||||
| select.POLLHUP
|
||||
| select.POLLERR,
|
||||
select.POLLIN | select.POLLPRI | select.POLLHUP | select.POLLERR,
|
||||
)
|
||||
poll.register(
|
||||
proc.stderr,
|
||||
select.POLLIN
|
||||
| select.POLLPRI
|
||||
| select.POLLHUP
|
||||
| select.POLLERR,
|
||||
select.POLLIN | select.POLLPRI | select.POLLHUP | select.POLLERR,
|
||||
)
|
||||
pollc = 3
|
||||
logger.debug("First poll...")
|
||||
@ -512,7 +511,7 @@ def main():
|
||||
logger.debug("Reading from stdout...")
|
||||
if chunk := proc.stdout.read(PIPE_BUF):
|
||||
logger.debug("Done, length %d", len(chunk))
|
||||
stdout_line_buffer.append(chunk)
|
||||
stdout_line_buffer.extend(chunk)
|
||||
while True:
|
||||
line, sep, rest = stdout_line_buffer.partition(
|
||||
b"\n"
|
||||
@ -526,7 +525,7 @@ def main():
|
||||
logger.debug("Reading from stderr...")
|
||||
if chunk := proc.stderr.read(PIPE_BUF):
|
||||
logger.debug("Done, length %d", len(chunk))
|
||||
stderr_line_buffer.append(chunk)
|
||||
stderr_line_buffer.extend(chunk)
|
||||
while True:
|
||||
line, sep, rest = stderr_line_buffer.partition(
|
||||
b"\n"
|
||||
@ -575,9 +574,6 @@ def main():
|
||||
logger.debug("Done")
|
||||
if ret != 0:
|
||||
raise Exception(f"borg subprocess exited with returncode {ret}")
|
||||
finally:
|
||||
download.close()
|
||||
download.release_conn()
|
||||
|
||||
copied.add(backup)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user