snapd api: wait longer
While these changes are not supposed to take nearly this long, per LP: #2034715 we know that they are, and that some systems will correctly perform the finish_install() step if just given more time.
This commit is contained in:
parent
aaaf87355c
commit
5a573f2cef
|
@ -33,6 +33,11 @@ log = logging.getLogger("subiquitycore.snapd")
|
||||||
|
|
||||||
|
|
||||||
class SnapdConnection:
|
class SnapdConnection:
|
||||||
|
# In LP: #2034715, we found that while some requests should be
|
||||||
|
# non-blocking, they are actually blocking and exceeding one minute.
|
||||||
|
# Extending the timeout helps.
|
||||||
|
default_timeout_seconds = 600
|
||||||
|
|
||||||
def __init__(self, root, sock):
|
def __init__(self, root, sock):
|
||||||
self.root = root
|
self.root = root
|
||||||
self.url_base = "http+unix://{}/".format(quote_plus(sock))
|
self.url_base = "http+unix://{}/".format(quote_plus(sock))
|
||||||
|
@ -41,13 +46,19 @@ class SnapdConnection:
|
||||||
if args:
|
if args:
|
||||||
path += "?" + urlencode(args)
|
path += "?" + urlencode(args)
|
||||||
with requests_unixsocket.Session() as session:
|
with requests_unixsocket.Session() as session:
|
||||||
return session.get(self.url_base + path, timeout=60)
|
return session.get(
|
||||||
|
self.url_base + path, timeout=self.default_timeout_seconds
|
||||||
|
)
|
||||||
|
|
||||||
def post(self, path, body, **args):
|
def post(self, path, body, **args):
|
||||||
if args:
|
if args:
|
||||||
path += "?" + urlencode(args)
|
path += "?" + urlencode(args)
|
||||||
with requests_unixsocket.Session() as session:
|
with requests_unixsocket.Session() as session:
|
||||||
return session.post(self.url_base + path, data=json.dumps(body), timeout=60)
|
return session.post(
|
||||||
|
self.url_base + path,
|
||||||
|
data=json.dumps(body),
|
||||||
|
timeout=self.default_timeout_seconds,
|
||||||
|
)
|
||||||
|
|
||||||
def configure_proxy(self, proxy):
|
def configure_proxy(self, proxy):
|
||||||
log.debug("restarting snapd to pick up proxy config")
|
log.debug("restarting snapd to pick up proxy config")
|
||||||
|
|
Loading…
Reference in New Issue