Skip to content

Commit 56a773b

Browse files
authored
CM-41489 - Increase default sync scans timeout; make sync scan timeout configurable via env var (#267)
1 parent 823e776 commit 56a773b

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

cycode/cli/consts.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,10 @@
155155
SENTRY_INCLUDE_LOCAL_VARIABLES = False
156156
SENTRY_MAX_REQUEST_BODY_SIZE = 'never'
157157

158+
# sync scans
159+
SYNC_SCAN_TIMEOUT_IN_SECONDS_ENV_VAR_NAME = 'SYNC_SCAN_TIMEOUT_IN_SECONDS'
160+
DEFAULT_SYNC_SCAN_TIMEOUT_IN_SECONDS = 180
161+
158162
# report with polling
159163
REPORT_POLLING_WAIT_INTERVAL_IN_SECONDS = 5
160164
DEFAULT_REPORT_POLLING_TIMEOUT_IN_SECONDS = 600

cycode/cli/user_settings/configuration_manager.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,13 @@ def get_scan_polling_timeout_in_seconds(self) -> int:
106106
)
107107
)
108108

109+
def get_sync_scan_timeout_in_seconds(self) -> int:
110+
return int(
111+
self._get_value_from_environment_variables(
112+
consts.SYNC_SCAN_TIMEOUT_IN_SECONDS_ENV_VAR_NAME, consts.DEFAULT_SYNC_SCAN_TIMEOUT_IN_SECONDS
113+
)
114+
)
115+
109116
def get_report_polling_timeout_in_seconds(self) -> int:
110117
return int(
111118
self._get_value_from_environment_variables(

cycode/cyclient/scan_client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from requests import Response
55

66
from cycode.cli import consts
7+
from cycode.cli.config import configuration_manager
78
from cycode.cli.exceptions.custom_exceptions import CycodeError
89
from cycode.cli.files_collector.models.in_memory_zip import InMemoryZip
910
from cycode.cyclient import models
@@ -133,7 +134,7 @@ def zipped_file_scan_sync(
133134
},
134135
files=files,
135136
hide_response_content_log=self._hide_response_log,
136-
timeout=60,
137+
timeout=configuration_manager.get_sync_scan_timeout_in_seconds(),
137138
)
138139
return models.ScanResultsSyncFlowSchema().load(response.json())
139140

0 commit comments

Comments
 (0)