changeset 738:b91fe30ae7aa

internal: Remove threading stuff we don't need anymore.
author Ludovic Chabant <ludovic@chabant.com>
date Thu, 02 Jun 2016 13:00:36 -0700
parents 8b3dfd91cbf6
children c6035785dbfc
files piecrust/serving/wrappers.py piecrust/templating/jinjaengine.py
diffstat 2 files changed, 10 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/piecrust/serving/wrappers.py	Wed Jun 01 23:15:07 2016 -0700
+++ b/piecrust/serving/wrappers.py	Thu Jun 02 13:00:36 2016 -0700
@@ -1,7 +1,6 @@
 import os
 import signal
 import logging
-import threading
 import urllib.request
 
 
--- a/piecrust/templating/jinjaengine.py	Wed Jun 01 23:15:07 2016 -0700
+++ b/piecrust/templating/jinjaengine.py	Thu Jun 02 13:00:36 2016 -0700
@@ -3,7 +3,6 @@
 import os.path
 import hashlib
 import logging
-import threading
 import email.utils
 import strict_rfc3339
 from jinja2 import Environment, FileSystemLoader, TemplateNotFound
@@ -448,8 +447,6 @@
 
     def __init__(self, environment):
         super(PieCrustCacheExtension, self).__init__(environment)
-        self._lock = threading.RLock()
-
         environment.extend(
             piecrust_cache_prefix='',
             piecrust_cache={}
@@ -490,18 +487,17 @@
             rdr_pass.used_source_names.update(pair[1])
             return pair[0]
 
-        with self._lock:
-            pair = self.environment.piecrust_cache.get(key)
-            if pair is not None:
-                rdr_pass.used_source_names.update(pair[1])
-                return pair[0]
+        pair = self.environment.piecrust_cache.get(key)
+        if pair is not None:
+            rdr_pass.used_source_names.update(pair[1])
+            return pair[0]
 
-            prev_used = rdr_pass.used_source_names.copy()
-            rv = caller()
-            after_used = rdr_pass.used_source_names.copy()
-            used_delta = after_used.difference(prev_used)
-            self.environment.piecrust_cache[key] = (rv, used_delta)
-            return rv
+        prev_used = rdr_pass.used_source_names.copy()
+        rv = caller()
+        after_used = rdr_pass.used_source_names.copy()
+        used_delta = after_used.difference(prev_used)
+        self.environment.piecrust_cache[key] = (rv, used_delta)
+        return rv
 
 
 class PieCrustSpacelessExtension(HtmlCompressor):