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