diff piecrust/environment.py @ 455:cb3446be44b7

bake: Abort "render first" jobs if we start using other pages. This prevents the baker from having one worker stuck on a very long job, like rendering the index page of a blog with lots and lots of posts.
author Ludovic Chabant <ludovic@chabant.com>
date Wed, 08 Jul 2015 22:51:29 -0700
parents 3b658190c02b
children 81d9c3a3a0b5
line wrap: on
line diff
--- a/piecrust/environment.py	Mon Jul 06 21:32:40 2015 -0700
+++ b/piecrust/environment.py	Wed Jul 08 22:51:29 2015 -0700
@@ -7,6 +7,10 @@
 logger = logging.getLogger(__name__)
 
 
+class AbortedSourceUseError(Exception):
+    pass
+
+
 class ExecutionInfo(object):
     def __init__(self, page, render_ctx):
         self.page = page
@@ -60,6 +64,7 @@
         self.fs_caches = {
                 'renders': self.rendered_segments_repository}
         self.fs_cache_only_for_main_page = False
+        self.abort_source_use = False
         self._default_layout_extensions = None
         self._timers = {}