Skip to content

Commit b9d7da4

Browse files
authored
Merge pull request #8501 from inverse-inc/fix/8492
fix 8492 - increase machine account timeout to 15s
2 parents fd75571 + 9b2c8b7 commit b9d7da4

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

bin/pyntlm_auth/handlers.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,11 +172,12 @@ def _submit_machine_account_test_job(machine_accounts, password=""):
172172

173173

174174
def _poll_machine_account_test_job_results(job_id, machine_accounts):
175-
exp_time = job_id + 2
175+
exp_time = job_id + 15
176176
results = {}
177177

178178
while time.time() < exp_time:
179-
time.sleep(0.3)
179+
time.sleep(0.5)
180+
done = True
180181

181182
for m in machine_accounts:
182183
if m in results and results[m]["status"] in ("OK", "Failed"):
@@ -188,6 +189,7 @@ def _poll_machine_account_test_job_results(job_id, machine_accounts):
188189
res = redis_client.r.get(key)
189190

190191
if res is None:
192+
done = False
191193
continue
192194

193195
if res == "OK":
@@ -200,8 +202,14 @@ def _poll_machine_account_test_job_results(job_id, machine_accounts):
200202

201203
except redis.ConnectionError:
202204
results[m] = {"status": "Exception", "reason": f"redis connection issue when fetching job result"}
205+
done = False
203206
except Exception as e:
204207
results[m] = {"status": "Exception", "reason": f"redis error '{str(e)}' when fetching job result"}
208+
done = False
209+
210+
if done:
211+
break
212+
205213
return results
206214

207215

go/ntlm/ntlm.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func CheckMachineAccountPassword(ctx context.Context, backendPort string) (bool,
2525
url := "http://containers-gateway.internal:" + backendPort + "/ntlm/connect"
2626

2727
client := &http.Client{
28-
Timeout: 5 * time.Second,
28+
Timeout: 16 * time.Second,
2929
}
3030
response, err := client.Get(url)
3131
if err != nil {
@@ -48,7 +48,7 @@ func CheckMachineAccountWithGivenPassword(ctx context.Context, backendPort strin
4848
url := "http://containers-gateway.internal:" + backendPort + "/ntlm/connect"
4949

5050
client := &http.Client{
51-
Timeout: 5 * time.Second,
51+
Timeout: 16 * time.Second,
5252
}
5353

5454
jsonData := map[string]string{

0 commit comments

Comments
 (0)