Skip to content

Commit

Permalink
Update cache.py
Browse files Browse the repository at this point in the history
  • Loading branch information
peterdudfield authored Oct 17, 2024
1 parent 86c2969 commit f86449a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pv_site_api/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ def remove_old_cache(
now = datetime.now(tz=timezone.utc)
logger.info("Removing old cache entries")
keys_to_remove = []
for key, value in last_updated.items():
last_updated_copy = last_updated.copy()
for key, value in last_updated_copy.items():
if now - timedelta(seconds=remove_cache_time_seconds) > value:
logger.debug(f"Removing {key} from cache, ({value})")
keys_to_remove.append(key)
Expand Down

0 comments on commit f86449a

Please sign in to comment.