Skip to content

Commit 27b2a2b

Browse files
committed
Reset CACHE_CLEARED after cache._save() is called
1 parent 723c63a commit 27b2a2b

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

stumpy/cache.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,18 @@ def _save():
222222
-------
223223
None
224224
"""
225+
global CACHE_CLEARED
226+
227+
if not CACHE_CLEARED: # pragma: no cover
228+
msg = "Numba njit cached files are not cleared before saving/overwriting. "
229+
msg = "You may need to call `cache.clear()` before calling `cache.save()`."
230+
warnings.warn(msg)
231+
225232
_enable()
226233
_recompile()
227234

235+
CACHE_CLEARED = False
236+
228237
return
229238

230239

@@ -258,11 +267,6 @@ def save():
258267
msg += "The `stumpy` cache files may not be saved/cleared correctly!"
259268
warnings.warn(msg)
260269

261-
if not CACHE_CLEARED: # pragma: no cover
262-
msg = "The cached files are not cleared before saving/overwriting. "
263-
msg = "You may need to call `cache.clear()` before calling `cache.save()`."
264-
warnings.warn("msg")
265-
266270
_save()
267271

268272
return

0 commit comments

Comments
 (0)