diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2023-08-31 04:38:34 +0000 |
---|---|---|
committer | AUTOMATIC1111 <16777216c@gmail.com> | 2023-08-31 04:38:34 +0000 |
commit | 5ef669de080814067961f28357256e8fe27544f4 (patch) | |
tree | 655f4582e692f0fc3667b3b668ad365ac3ab92ae /modules/cache.py | |
parent | c9c8485bc1e8720aba70f029d25cba1c4abf2b5c (diff) | |
parent | e7965a5eb804a51e949df07c66c0b7c61ab7fa7b (diff) | |
download | stable-diffusion-webui-gfx803-5ef669de080814067961f28357256e8fe27544f4.tar.gz stable-diffusion-webui-gfx803-5ef669de080814067961f28357256e8fe27544f4.tar.bz2 stable-diffusion-webui-gfx803-5ef669de080814067961f28357256e8fe27544f4.zip |
Merge branch 'release_candidate'
Diffstat (limited to 'modules/cache.py')
-rw-r--r-- | modules/cache.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/modules/cache.py b/modules/cache.py index 71fe6302..ff26a213 100644 --- a/modules/cache.py +++ b/modules/cache.py @@ -1,11 +1,12 @@ import json
+import os
import os.path
import threading
import time
from modules.paths import data_path, script_path
-cache_filename = os.path.join(data_path, "cache.json")
+cache_filename = os.environ.get('SD_WEBUI_CACHE_FILE', os.path.join(data_path, "cache.json"))
cache_data = None
cache_lock = threading.Lock()
@@ -29,9 +30,12 @@ def dump_cache(): time.sleep(1)
with cache_lock:
- with open(cache_filename, "w", encoding="utf8") as file:
+ cache_filename_tmp = cache_filename + "-"
+ with open(cache_filename_tmp, "w", encoding="utf8") as file:
json.dump(cache_data, file, indent=4)
+ os.replace(cache_filename_tmp, cache_filename)
+
dump_cache_after = None
dump_cache_thread = None
|