mirror of
https://github.com/krateng/maloja.git
synced 2025-05-04 17:11:03 +03:00
Fixed rentention of cache age
This commit is contained in:
parent
4d9a35e3eb
commit
2fee52f28c
@ -294,7 +294,7 @@ def track_from_cache(artists,title):
|
|||||||
nowday = datetime.date.today().toordinal()
|
nowday = datetime.date.today().toordinal()
|
||||||
cacheday = cachedTracksDays[(frozenset(artists),title)]
|
cacheday = cachedTracksDays[(frozenset(artists),title)]
|
||||||
|
|
||||||
if nowday - cacheday > retain:
|
if (nowday - cacheday) > retain:
|
||||||
# fetch the new image in the background, but still return the old one for one last time
|
# fetch the new image in the background, but still return the old one for one last time
|
||||||
log("Expired cache for " + "/".join(artists) + " - " + title)
|
log("Expired cache for " + "/".join(artists) + " - " + title)
|
||||||
del cachedTracks[(frozenset(artists),title)]
|
del cachedTracks[(frozenset(artists),title)]
|
||||||
@ -321,7 +321,7 @@ def artist_from_cache(artist):
|
|||||||
nowday = datetime.date.today().toordinal()
|
nowday = datetime.date.today().toordinal()
|
||||||
cacheday = cachedArtistsDays[artist]
|
cacheday = cachedArtistsDays[artist]
|
||||||
|
|
||||||
if nowday - cacheday > retain:
|
if (nowday - cacheday) > retain:
|
||||||
# fetch the new image in the background, but still return the old one for one last time
|
# fetch the new image in the background, but still return the old one for one last time
|
||||||
log("Expired cache for " + artist)
|
log("Expired cache for " + artist)
|
||||||
del cachedArtists[artist]
|
del cachedArtists[artist]
|
||||||
@ -344,7 +344,7 @@ def loadCache():
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
ob = pickle.loads(fl.read())
|
ob = pickle.loads(fl.read())
|
||||||
global cachedTracks, cachedArtists
|
global cachedTracks, cachedArtists, cachedTracksDays, cachedArtistsDays
|
||||||
cachedTracks, cachedArtists, cachedTracksDays, cachedArtistsDays = ob["tracks"],ob["artists"],ob["tracks_days"],ob["artists_days"]
|
cachedTracks, cachedArtists, cachedTracksDays, cachedArtistsDays = ob["tracks"],ob["artists"],ob["tracks_days"],ob["artists_days"]
|
||||||
#(cachedTracks, cachedArtists) = ob
|
#(cachedTracks, cachedArtists) = ob
|
||||||
finally:
|
finally:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user