##// END OF EJS Templates
phabricator: use the `http.timeout` config for conduit call...
marmoute -
r46584:4d70444c default
parent child Browse files
Show More
@@ -43,6 +43,12 b' Config::'
43 retry = 3
43 retry = 3
44 retry.interval = 10
44 retry.interval = 10
45
45
46 # the retry option can combine well with the http.timeout one.
47 #
48 # For example to give up on http request after 20 seconds:
49 [http]
50 timeout=20
51
46 [auth]
52 [auth]
47 example.schemes = https
53 example.schemes = https
48 example.prefix = phab.example.com
54 example.prefix = phab.example.com
@@ -420,9 +426,12 b' def callconduit(ui, name, params):'
420 urlopener = urlmod.opener(ui, authinfo)
426 urlopener = urlmod.opener(ui, authinfo)
421 request = util.urlreq.request(pycompat.strurl(url), data=data)
427 request = util.urlreq.request(pycompat.strurl(url), data=data)
422 max_try = ui.configint(b'phabricator', b'retry') + 1
428 max_try = ui.configint(b'phabricator', b'retry') + 1
429 timeout = ui.configwith(float, b'http', b'timeout')
423 for try_count in range(max_try):
430 for try_count in range(max_try):
424 try:
431 try:
425 with contextlib.closing(urlopener.open(request)) as rsp:
432 with contextlib.closing(
433 urlopener.open(request, timeout=timeout)
434 ) as rsp:
426 body = rsp.read()
435 body = rsp.read()
427 break
436 break
428 except util.urlerr.urlerror as err:
437 except util.urlerr.urlerror as err:
General Comments 0
You need to be logged in to leave comments. Login now