Merge pull request #72 from hiromi-mi/fix_local_actor_cache
Create config/local_actor_hash if not exists
This commit is contained in:
@@ -5,12 +5,13 @@ _CACHE_FILE = Path(__file__).parent.absolute() / ".." / "config" / "local_actor_
|
|||||||
|
|
||||||
def is_actor_updated(actor_hash: str) -> bool:
|
def is_actor_updated(actor_hash: str) -> bool:
|
||||||
actor_updated = False
|
actor_updated = False
|
||||||
if _CACHE_FILE.exists():
|
cache_exists = _CACHE_FILE.exists()
|
||||||
|
if cache_exists:
|
||||||
current_hash = _CACHE_FILE.read_text()
|
current_hash = _CACHE_FILE.read_text()
|
||||||
if actor_hash != current_hash:
|
if actor_hash != current_hash:
|
||||||
actor_updated = True
|
actor_updated = True
|
||||||
|
|
||||||
if actor_updated:
|
if actor_updated or not cache_exists:
|
||||||
with _CACHE_FILE.open("w") as f:
|
with _CACHE_FILE.open("w") as f:
|
||||||
f.write(actor_hash)
|
f.write(actor_hash)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user