From 40842e8431a8c248c0d767c3b24a21d95bc136b4 Mon Sep 17 00:00:00 2001 From: Matt Singleton Date: Sat, 14 Oct 2017 19:31:11 -0400 Subject: debug mode causes exceptions to raise immediately --- unbiased/main.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/unbiased/main.py b/unbiased/main.py index 7b057ea..89071b1 100755 --- a/unbiased/main.py +++ b/unbiased/main.py @@ -68,7 +68,7 @@ def main(): while True: logger.info('Starting crawl') start = time.time() - run(args.webroot, args.sources) + run(args.webroot, args.sources, args.debug) finish = time.time() runtime = finish - start sleeptime = crawl_frequency - runtime @@ -78,12 +78,11 @@ def main(): if sleeptime > 0: time.sleep(sleeptime) -def run(webroot, source_names): +def run(webroot, source_names, debug_mode=False): logger.debug('Running with webroot="{}" for sources="{}"'.format(webroot, source_names)) sources = get_sources() - print(sources) if source_names is None: sources = sources.values() else: @@ -99,6 +98,8 @@ def run(webroot, source_names): built_sources.append(source.build()) break except Exception as ex: + if debug_mode is True: + raise tries += 1 if tries == 3: logger.error('Build failed. source={} ex={}'.format(source.name, ex)) -- cgit v1.2.3