Debug
This commit is contained in:
parent
404db42aea
commit
d848b9ce3c
1 changed files with 4 additions and 4 deletions
|
@ -24,23 +24,23 @@ def notify_done(key):
|
|||
data=dict()
|
||||
with open(CACHE_FILE, 'rb') as f:
|
||||
data=pickle.load(f)
|
||||
if datetime.timestamp(datetime.now()) - data["ts"] >= CACHE_EXPIRE*60:
|
||||
if datetime.timestamp(datetime.now()) - data[key] >= CACHE_EXPIRE*60:
|
||||
remove(CACHE_FILE)
|
||||
return(False)
|
||||
else:
|
||||
return(key in data["keys"])
|
||||
return(key in data)
|
||||
|
||||
# Save notify key in cache
|
||||
def add_key(key):
|
||||
if not(path.exists(CACHE_FILE)):
|
||||
with open(CACHE_FILE, 'wb') as f:
|
||||
pickle.dump({"ts":datetime.timestamp(datetime.now()),"keys":key},f)
|
||||
pickle.dump({key:datetime.timestamp(datetime.now())},f)
|
||||
else:
|
||||
data=list()
|
||||
with open(CACHE_FILE, 'rb') as f:
|
||||
data=pickle.load(f)
|
||||
if not(key in data["keys"]):
|
||||
data["keys"].append(key)
|
||||
data[key]=datetime.timestamp(datetime.now())
|
||||
with open(CACHE_FILE, 'wb') as f:
|
||||
pickle.dump(data,f)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue