From 7937e9dbcf55030728b7f7618d62d0759382ee47 Mon Sep 17 00:00:00 2001 From: Valentin Buira Date: Fri, 11 Jul 2025 19:06:35 +0200 Subject: [PATCH 1/2] increase log size to maximun 8 mb --- mergin/client.py | 12 ++++++++---- mergin/common.py | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/mergin/client.py b/mergin/client.py index 6456c1b..cfbee87 100644 --- a/mergin/client.py +++ b/mergin/client.py @@ -1424,16 +1424,20 @@ def send_logs( platform.system(), self.url, self.username() ) + # We send more from the local logs + global_logs_file_size_to_send = MAX_LOG_FILE_SIZE_TO_SEND * 0.2 + local_logs_file_size_to_send = MAX_LOG_FILE_SIZE_TO_SEND * 0.8 + global_logs = b"" if global_log_file and os.path.exists(global_log_file): with open(global_log_file, "rb") as f: - if os.path.getsize(global_log_file) > LOG_FILE_SIZE_TO_SEND: - f.seek(-LOG_FILE_SIZE_TO_SEND, os.SEEK_END) + if os.path.getsize(global_log_file) > global_logs_file_size_to_send: + f.seek(-global_logs_file_size_to_send, os.SEEK_END) global_logs = f.read() + b"\n--------------------------------\n\n" with open(logfile, "rb") as f: - if os.path.getsize(logfile) > 512 * 1024: - f.seek(-512 * 1024, os.SEEK_END) + if os.path.getsize(logfile) > local_logs_file_size_to_send: + f.seek(-local_logs_file_size_to_send, os.SEEK_END) logs = f.read() payload = meta.encode() + global_logs + logs diff --git a/mergin/common.py b/mergin/common.py index 9e65a6c..a0b4760 100644 --- a/mergin/common.py +++ b/mergin/common.py @@ -7,7 +7,7 @@ UPLOAD_CHUNK_SIZE = 10 * 1024 * 1024 # size of the log file part to send (if file is larger only this size from end will be sent) -LOG_FILE_SIZE_TO_SEND = 100 * 1024 +MAX_LOG_FILE_SIZE_TO_SEND = 8 * 1024 * 1024 # default URL for submitting logs MERGIN_DEFAULT_LOGS_URL = "https://g4pfq226j0.execute-api.eu-west-1.amazonaws.com/mergin_client_log_submit" From 23dbdfb52ba1ea1477f40830f15c3f0b6672c298 Mon Sep 17 00:00:00 2001 From: Valentin Buira Date: Fri, 11 Jul 2025 19:10:06 +0200 Subject: [PATCH 2/2] fix test --- mergin/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mergin/client.py b/mergin/client.py index cfbee87..a82ea99 100644 --- a/mergin/client.py +++ b/mergin/client.py @@ -19,7 +19,7 @@ from typing import List -from .common import ClientError, LoginError, WorkspaceRole, ProjectRole, LOG_FILE_SIZE_TO_SEND, MERGIN_DEFAULT_LOGS_URL +from .common import ClientError, LoginError, WorkspaceRole, ProjectRole, MAX_LOG_FILE_SIZE_TO_SEND, MERGIN_DEFAULT_LOGS_URL from .merginproject import MerginProject from .client_pull import ( download_file_finalize,