From ba95d6bdf96ad4bbefcb41f1185ccedc63b721a4 Mon Sep 17 00:00:00 2001 From: hiromi-mi Date: Thu, 27 Feb 2020 23:24:08 +0900 Subject: [PATCH] Create config/local_actor_hash if not exists After I change my profile in `config/me.yml` and start microblog.pub again, remote instances is not sometimes be updated the profile. This is probably because `config/local_actor_hash` is not created, and `is_actor_updated()` always returns `False`. --- utils/local_actor_cache.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/utils/local_actor_cache.py b/utils/local_actor_cache.py index c0c3e67..3b10735 100644 --- a/utils/local_actor_cache.py +++ b/utils/local_actor_cache.py @@ -5,12 +5,13 @@ _CACHE_FILE = Path(__file__).parent.absolute() / ".." / "config" / "local_actor_ def is_actor_updated(actor_hash: str) -> bool: actor_updated = False - if _CACHE_FILE.exists(): + cache_exists = _CACHE_FILE.exists() + if cache_exists: current_hash = _CACHE_FILE.read_text() if actor_hash != current_hash: actor_updated = True - if actor_updated: + if actor_updated or not cache_exists: with _CACHE_FILE.open("w") as f: f.write(actor_hash)