aboutsummaryrefslogtreecommitdiff
path: root/rwa/support/sessionservice/lock.py
diff options
context:
space:
mode:
authorJonathan Weth <git@jonathanweth.de>2021-06-23 14:39:01 +0200
committerJonathan Weth <git@jonathanweth.de>2021-06-23 14:39:01 +0200
commit3cf9c8b9ef994b8341b3c19bb4458c198a51992c (patch)
treeb7fad96786ac2924842559dd9631bcd90d622ce8 /rwa/support/sessionservice/lock.py
parented1d15aa02b3c7c1350a5204861d1f8678550fbb (diff)
downloadRWA.Support.SessionService-3cf9c8b9ef994b8341b3c19bb4458c198a51992c.tar.gz
RWA.Support.SessionService-3cf9c8b9ef994b8341b3c19bb4458c198a51992c.tar.bz2
RWA.Support.SessionService-3cf9c8b9ef994b8341b3c19bb4458c198a51992c.zip
Introduce and apply reformat/lint
Diffstat (limited to 'rwa/support/sessionservice/lock.py')
-rw-r--r--rwa/support/sessionservice/lock.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/rwa/support/sessionservice/lock.py b/rwa/support/sessionservice/lock.py
index b4e384c..49be2f5 100644
--- a/rwa/support/sessionservice/lock.py
+++ b/rwa/support/sessionservice/lock.py
@@ -26,13 +26,13 @@
import os
import tempfile
-lock_dir_path = os.path.join(tempfile.gettempdir(), "rwa.support.sessionservice")
-lock_file_path = os.path.join(lock_dir_path, "rwa.support.sessionservice.lock")
+TEMP_DIR_PATH = os.path.join(tempfile.gettempdir(), "rwa.support.sessionservice")
+lock_file_path = os.path.join(TEMP_DIR_PATH, "rwa.support.sessionservice.lock")
def lock():
"""Create lock file."""
- os.makedirs(lock_dir_path, exist_ok=True)
+ os.makedirs(TEMP_DIR_PATH, exist_ok=True)
with open(lock_file_path, "w") as f:
f.write("lock")
@@ -48,3 +48,7 @@ def unlock():
os.remove(lock_file_path)
except FileNotFoundError:
pass
+
+
+# Always ensure temp dir
+os.makedirs(TEMP_DIR_PATH, exist_ok=True)