Logging adjustments

This commit is contained in:
krateng 2022-02-18 20:01:17 +01:00
parent 9e4274f209
commit a367c7c573
2 changed files with 8 additions and 3 deletions

View File

@ -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")

View File

@ -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)")