Parcourir la source

Experimental use of threading.local variable for env.

Stefano Cossu il y a 7 ans
Parent
commit
cad81fa9f4
1 fichiers modifiés avec 5 ajouts et 2 suppressions
  1. 5 2
      lakesuperior/env.py

+ 5 - 2
lakesuperior/env.py

@@ -21,5 +21,8 @@ This is automated in non-test environments by importing
 class Env:
     pass
 
-env = Env()
-#env = threading.local()
+# NOTE: this can lead to race conditions in multi-thread operations competing
+# to set a timestamp.
+#env = Env()
+# NOTE: This should be thread-safe but is experimental.
+env = threading.local()