Skip to content

Commit de0b4f7

Browse files
authored
Fix flush timeout (#602)
1 parent fd0dcfd commit de0b4f7

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

docs/changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
This changelog documents user-relevant changes to the GitHub runner charm.
44

5+
## 2025-07-28
6+
7+
- Fix an issue where the charm can error out due to timeout during flush runners.
8+
59
## 2025-07-24
610

711
- Fix an issue with infinite retry of a reactive job message.

src/manager_client.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@
2424
NO_RESPONSE_ERROR_MESSAGE = "Failed request with no response"
2525
CONNECTION_ERROR_MESSAGE = "Failed request due to connection failure"
2626
NOT_READY_ERROR_MESSAGE = "GitHub runner manager service not ready"
27+
# For request that modifies the runner, GitHub runner manager service might need to wait for
28+
# reconcile to finish before processing the request, hence the long timeout for write-level
29+
# requests.
30+
WRITE_TIMEOUT = 60 * 20
31+
READ_TIMEOUT = 60 * 5
2732

2833

2934
def catch_requests_errors(func: Callable) -> Callable:
@@ -124,7 +129,7 @@ def check_runner(self) -> dict[str, str]:
124129
The information on the runners.
125130
"""
126131
self.wait_till_ready()
127-
response = self._request(_HTTPMethod.GET, "/runner/check", timeout=600)
132+
response = self._request(_HTTPMethod.GET, "/runner/check", timeout=READ_TIMEOUT)
128133
runner_info = json.loads(response.text)
129134
runner_info["runners"] = tuple(runner_info["runners"])
130135
runner_info["busy_runners"] = tuple(runner_info["busy_runners"])
@@ -140,7 +145,7 @@ def flush_runner(self, busy: bool = False) -> None:
140145
"""
141146
self.wait_till_ready()
142147
params = {"flush-busy": str(busy)}
143-
self._request(_HTTPMethod.POST, "/runner/flush", params=params, timeout=600)
148+
self._request(_HTTPMethod.POST, "/runner/flush", params=params, timeout=WRITE_TIMEOUT)
144149

145150
def health_check(self) -> None:
146151
"""Request a health check on the runner manager service.
@@ -153,7 +158,7 @@ def health_check(self) -> None:
153158
API requests.
154159
"""
155160
try:
156-
response = self._request(_HTTPMethod.GET, "/health", timeout=60)
161+
response = self._request(_HTTPMethod.GET, "/health", timeout=READ_TIMEOUT)
157162
except requests.HTTPError as err:
158163
raise RunnerManagerServiceNotReadyError(NOT_READY_ERROR_MESSAGE) from err
159164
except requests.ConnectionError as err:

0 commit comments

Comments
 (0)