Improve YAML deadline warning

See #2777
This commit is contained in:
Florian Bruhin 2017-10-11 13:05:05 +02:00
parent 4827e98b4e
commit f5e7388bfe

View File

@ -882,15 +882,18 @@ def yaml_load(f):
end = datetime.datetime.now()
delta = (end - start).total_seconds()
deadline = 3 if 'CI' in os.environ else 0.5
if delta > deadline:
log.misc.error(
"YAML load took {}s\n"
"version: {}\n"
"C extension: {}\n\n"
deadline = 3 if 'CI' in os.environ else 1
if delta > deadline: # pragma: no cover
log.misc.warning(
"YAML load took unusually long, please report this at "
"https://github.com/qutebrowser/qutebrowser/issues/2777\n"
"duration: {}s\n"
"PyYAML version: {}\n"
"C extension: {}\n"
"Stack:\n\n"
"{}".format(
delta, yaml.__version__, YAML_C_EXT,
'\n'.join(traceback.format_stack())))
''.join(traceback.format_stack())))
return data