Development
This commit is contained in:
parent
27f2356cd1
commit
19f0bfa79c
4 changed files with 115 additions and 21 deletions
|
|
@ -25,10 +25,20 @@ DASHB_INTERVAL_SECS = 60
|
|||
QUEUE_MAX_LINES = 50
|
||||
|
||||
|
||||
_config_cache = None
|
||||
_config_mtime = None
|
||||
|
||||
def load_config():
|
||||
global _config_cache, _config_mtime
|
||||
try:
|
||||
mtime = os.path.getmtime(CONFIG_FILE)
|
||||
if _config_cache is not None and mtime == _config_mtime:
|
||||
return copy.deepcopy(_config_cache)
|
||||
with open(CONFIG_FILE) as f:
|
||||
return json.load(f)
|
||||
data = json.load(f)
|
||||
_config_cache = data
|
||||
_config_mtime = mtime
|
||||
return copy.deepcopy(data)
|
||||
except Exception:
|
||||
return {}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue