forked from platformio/platformio-core
Improve a work in off-line mode
This commit is contained in:
@ -7,6 +7,7 @@ PlatformIO 3.0
|
|||||||
3.0.2 (2016-09-??)
|
3.0.2 (2016-09-??)
|
||||||
~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
* Improved a work in off-line mode
|
||||||
* Improved Project Generator when custom ``--project-option`` is passed to
|
* Improved Project Generator when custom ``--project-option`` is passed to
|
||||||
`platformio init <http://docs.platformio.org/en/stable/userguide/cmd_init.html>`__
|
`platformio init <http://docs.platformio.org/en/stable/userguide/cmd_init.html>`__
|
||||||
command
|
command
|
||||||
|
@ -34,7 +34,9 @@ from platformio.managers.platform import PlatformManager
|
|||||||
from platformio.pioplus import pioplus_update
|
from platformio.pioplus import pioplus_update
|
||||||
|
|
||||||
|
|
||||||
def in_silence(ctx):
|
def in_silence(ctx=None):
|
||||||
|
ctx = ctx or app.get_session_var("command_ctx")
|
||||||
|
assert ctx
|
||||||
ctx_args = ctx.args or []
|
ctx_args = ctx.args or []
|
||||||
return (ctx_args and
|
return (ctx_args and
|
||||||
(ctx.args[0] == "upgrade" or "--json-output" in ctx_args))
|
(ctx.args[0] == "upgrade" or "--json-output" in ctx_args))
|
||||||
|
@ -417,11 +417,13 @@ def get_api_result(path, params=None, data=None):
|
|||||||
return _get_api_result(path, params, data)
|
return _get_api_result(path, params, data)
|
||||||
except (requests.exceptions.ConnectionError,
|
except (requests.exceptions.ConnectionError,
|
||||||
requests.exceptions.Timeout) as e:
|
requests.exceptions.Timeout) as e:
|
||||||
|
from platformio.maintenance import in_silence
|
||||||
total += 1
|
total += 1
|
||||||
click.secho(
|
if not in_silence():
|
||||||
"[API] ConnectionError: {0} (incremented retry: max={1}, "
|
click.secho(
|
||||||
"total={2})".format(e, max_retries, total),
|
"[API] ConnectionError: {0} (incremented retry: max={1}, "
|
||||||
fg="yellow")
|
"total={2})".format(e, max_retries, total),
|
||||||
|
fg="yellow")
|
||||||
sleep(2 * total)
|
sleep(2 * total)
|
||||||
|
|
||||||
raise exception.APIRequestError(
|
raise exception.APIRequestError(
|
||||||
|
Reference in New Issue
Block a user