Skip to content

Commit 3106f3e

Browse files
committed
stored predefined values in common
1 parent d706fe1 commit 3106f3e

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

mergin/client.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
from typing import List
2121

22-
from .common import ClientError, LoginError, WorkspaceRole, ProjectRole
22+
from .common import ClientError, LoginError, WorkspaceRole, ProjectRole, LOG_FILE_SIZE_TO_SEND, MERGIN_DEFAULT_LOGS_URL
2323
from .merginproject import MerginProject
2424
from .client_pull import (
2525
download_file_finalize,
@@ -40,8 +40,6 @@
4040
this_dir = os.path.dirname(os.path.realpath(__file__))
4141
json_headers = {"Content-Type": "application/json"}
4242

43-
MERGIN_DEFAULT_LOGS_URL = "https://g4pfq226j0.execute-api.eu-west-1.amazonaws.com/mergin_client_log_submit"
44-
4543

4644
class TokenError(Exception):
4745
pass
@@ -1402,8 +1400,8 @@ def send_logs(
14021400
global_logs = b""
14031401
if global_log_file and os.path.exists(global_log_file):
14041402
with open(global_log_file, "rb") as f:
1405-
if os.path.getsize(global_log_file) > 100 * 1024:
1406-
f.seek(-100 * 1024, os.SEEK_END)
1403+
if os.path.getsize(global_log_file) > LOG_FILE_SIZE_TO_SEND:
1404+
f.seek(-LOG_FILE_SIZE_TO_SEND, os.SEEK_END)
14071405
global_logs = f.read() + b"\n--------------------------------\n\n"
14081406

14091407
with open(logfile, "rb") as f:

mergin/common.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
# there is an upper limit for chunk size on server, ideally should be requested from there once implemented
77
UPLOAD_CHUNK_SIZE = 10 * 1024 * 1024
88

9+
# 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
11+
12+
# default URL for submitting logs
13+
MERGIN_DEFAULT_LOGS_URL = "https://g4pfq226j0.execute-api.eu-west-1.amazonaws.com/mergin_client_log_submit"
914

1015
this_dir = os.path.dirname(os.path.realpath(__file__))
1116

0 commit comments

Comments
 (0)