mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
Logging adjustments
This commit is contained in:
parent
9e4274f209
commit
a367c7c573
@ -46,9 +46,14 @@ def cached_wrapper(inner_func):
|
||||
|
||||
|
||||
def invalidate_caches(scrobbletime):
|
||||
cleared, kept = 0, 0
|
||||
for k in cache.keys():
|
||||
if (k[3] is None or scrobbletime >= k[3]) and (k[4] is None or scrobbletime <= k[4]):
|
||||
cleared += 1
|
||||
del cache[k]
|
||||
else:
|
||||
kept += 1
|
||||
log(f"Invalidated {cleared} of {cleared+kept} DB cache entries")
|
||||
|
||||
|
||||
|
||||
|
@ -586,7 +586,7 @@ def clean_db():
|
||||
delete from tracks where id not in (select track_id from scrobbles)
|
||||
''')).rowcount
|
||||
|
||||
log(f"Deleted {a2} tracks without scrobbles ({a1} track artist entries)")
|
||||
if a2+a1>0: log(f"Deleted {a2} tracks without scrobbles ({a1} track artist entries)")
|
||||
|
||||
### Delete artists that have no tracks
|
||||
# we actually don't wanna do that as it will break collection artists
|
||||
@ -595,7 +595,7 @@ def clean_db():
|
||||
# delete from artists where id not in (select artist_id from trackartists)
|
||||
#''')).rowcount
|
||||
#
|
||||
#log(f"Deleted {a3} artists without tracks")
|
||||
#if a3>0: log(f"Deleted {a3} artists without tracks")
|
||||
|
||||
### Delete tracks that have no artists (delete their scrobbles first)
|
||||
a4 = conn.execute(sql.text('''
|
||||
@ -605,7 +605,7 @@ def clean_db():
|
||||
delete from tracks where id not in (select track_id from trackartists)
|
||||
''')).rowcount
|
||||
|
||||
log(f"Deleted {a5} tracks without artists ({a4} scrobbles)")
|
||||
if a5+a4>0: log(f"Deleted {a5} tracks without artists ({a4} scrobbles)")
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user