Skip to content

Commit 7937e9d

Browse files
committed
increase log size to maximun 8 mb
1 parent 2440b66 commit 7937e9d

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

mergin/client.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1424,16 +1424,20 @@ def send_logs(
14241424
platform.system(), self.url, self.username()
14251425
)
14261426

1427+
# We send more from the local logs
1428+
global_logs_file_size_to_send = MAX_LOG_FILE_SIZE_TO_SEND * 0.2
1429+
local_logs_file_size_to_send = MAX_LOG_FILE_SIZE_TO_SEND * 0.8
1430+
14271431
global_logs = b""
14281432
if global_log_file and os.path.exists(global_log_file):
14291433
with open(global_log_file, "rb") as f:
1430-
if os.path.getsize(global_log_file) > LOG_FILE_SIZE_TO_SEND:
1431-
f.seek(-LOG_FILE_SIZE_TO_SEND, os.SEEK_END)
1434+
if os.path.getsize(global_log_file) > global_logs_file_size_to_send:
1435+
f.seek(-global_logs_file_size_to_send, os.SEEK_END)
14321436
global_logs = f.read() + b"\n--------------------------------\n\n"
14331437

14341438
with open(logfile, "rb") as f:
1435-
if os.path.getsize(logfile) > 512 * 1024:
1436-
f.seek(-512 * 1024, os.SEEK_END)
1439+
if os.path.getsize(logfile) > local_logs_file_size_to_send:
1440+
f.seek(-local_logs_file_size_to_send, os.SEEK_END)
14371441
logs = f.read()
14381442

14391443
payload = meta.encode() + global_logs + logs

mergin/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
UPLOAD_CHUNK_SIZE = 10 * 1024 * 1024
88

99
# size of the log file part to send (if file is larger only this size from end will be sent)
10-
LOG_FILE_SIZE_TO_SEND = 100 * 1024
10+
MAX_LOG_FILE_SIZE_TO_SEND = 8 * 1024 * 1024
1111

1212
# default URL for submitting logs
1313
MERGIN_DEFAULT_LOGS_URL = "https://g4pfq226j0.execute-api.eu-west-1.amazonaws.com/mergin_client_log_submit"

0 commit comments

Comments
 (0)