mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-24 17:28:08 +00:00
Do not timeout forwarded calls
This commit is contained in:
parent
d30abeca21
commit
dcebaf61b8
@ -34,6 +34,22 @@ class ComputeError(ControllerError):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class Timeout(aiohttp.Timeout):
|
||||||
|
"""
|
||||||
|
Could be removed with aiohttp 0.22 that support None timeout
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __enter__(self):
|
||||||
|
if self._timeout:
|
||||||
|
return super().__enter__()
|
||||||
|
return self
|
||||||
|
|
||||||
|
def __exit__(self, exc_type, exc_val, exc_tb):
|
||||||
|
if self._timeout:
|
||||||
|
return super().__exit__(exc_type, exc_val, exc_tb)
|
||||||
|
return self
|
||||||
|
|
||||||
|
|
||||||
class Compute:
|
class Compute:
|
||||||
"""
|
"""
|
||||||
A GNS3 compute.
|
A GNS3 compute.
|
||||||
@ -266,7 +282,7 @@ class Compute:
|
|||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def _run_http_query(self, method, path, data=None, timeout=10):
|
def _run_http_query(self, method, path, data=None, timeout=10):
|
||||||
with aiohttp.Timeout(timeout):
|
with Timeout(timeout):
|
||||||
url = self._getUrl(path)
|
url = self._getUrl(path)
|
||||||
headers = {}
|
headers = {}
|
||||||
headers['content-type'] = 'application/json'
|
headers['content-type'] = 'application/json'
|
||||||
@ -335,5 +351,5 @@ class Compute:
|
|||||||
"""
|
"""
|
||||||
Forward a call to the emulator on compute
|
Forward a call to the emulator on compute
|
||||||
"""
|
"""
|
||||||
res = yield from self.http_query(method, "/{}/{}".format(type, path), data=data)
|
res = yield from self.http_query(method, "/{}/{}".format(type, path), data=data, timeout=None)
|
||||||
return res.json
|
return res.json
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
jsonschema>=2.4.0
|
jsonschema>=2.4.0
|
||||||
aiohttp>=0.21.5
|
aiohttp>=0.21.6
|
||||||
aiohttp_cors>=0.4.0
|
aiohttp_cors>=0.4.0
|
||||||
Jinja2>=2.7.3
|
Jinja2>=2.7.3
|
||||||
raven>=5.2.0
|
raven>=5.2.0
|
||||||
|
Loading…
Reference in New Issue
Block a user