[cli] cache last mod AFTER the function call

pull/2/head
Daniel Van Der Maden 5 years ago
parent d8db3419c9
commit eeae66896b
  1. 2
      pyhmy/cli.py

@ -69,8 +69,8 @@ def _cache_account_function(fn):
key = (args, frozenset(kwargs.items())) key = (args, frozenset(kwargs.items()))
mod_hash = hash(_account_keystore_path + str(os.path.getmtime(_account_keystore_path))) mod_hash = hash(_account_keystore_path + str(os.path.getmtime(_account_keystore_path)))
if last_mod_hash is None or mod_hash != last_mod_hash or key not in cache.keys(): if last_mod_hash is None or mod_hash != last_mod_hash or key not in cache.keys():
last_mod_hash = mod_hash
cache[key] = fn(*args, **kwargs) cache[key] = fn(*args, **kwargs)
last_mod_hash = hash(_account_keystore_path + str(os.path.getmtime(_account_keystore_path)))
return cache[key] return cache[key]
return wrap return wrap

Loading…
Cancel
Save