Mercurial > piecrust2
diff piecrust/baking/worker.py @ 1014:071f30aa04bb
bake: Do template caching in a background job if possible.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Tue, 28 Nov 2017 21:28:15 -0800 |
parents | 2e5c5d33d62c |
children | fa489c5e829e |
line wrap: on
line diff
--- a/piecrust/baking/worker.py Tue Nov 28 21:27:57 2017 -0800 +++ b/piecrust/baking/worker.py Tue Nov 28 21:28:15 2017 -0800 @@ -80,6 +80,15 @@ source_name, item_spec = job['job_spec'] logger.debug("Received job: %s@%s" % (source_name, item_spec)) + # Check for special jobs. + if source_name == '__special__': + if item_spec == 'populate_template_cache': + for eng in self.app.plugin_loader.getTemplateEngines(): + eng.populateCache() + else: + raise Exception("Unknown special job: %s" % item_spec) + return {} + # Run the job! job_start = time.perf_counter() pp = self.ppmngr.getPipeline(source_name)