various
This commit is contained in:
@@ -97,19 +97,18 @@ class RedisCache:
|
||||
|
||||
async def get_found_counts(self) -> dict:
|
||||
"""
|
||||
Get found counts for all sources
|
||||
Get found counts for all sources (and failed count)
|
||||
Args:
|
||||
None
|
||||
Returns:
|
||||
dict: In the form {'source': count, 'source2': count, ...}
|
||||
"""
|
||||
try:
|
||||
sources: list = ["cache", "lrclib", "genius"]
|
||||
sources: list = ["cache", "lrclib", "genius", "failed"]
|
||||
counts: dict = {}
|
||||
for src in sources:
|
||||
src_found_count = await self.redis_client.get(f"returned:{src}")
|
||||
counts[src] = src_found_count
|
||||
logging.info("Returning: %s", counts)
|
||||
return counts
|
||||
except Exception as e:
|
||||
await self.notifier.send(f"ERROR @ {__file__.rsplit("/", maxsplit=1)[-1]}", f"{str(e)}")
|
||||
@@ -204,11 +203,11 @@ class RedisCache:
|
||||
jsonset = await self.redis_client.json().set(newkey, Path.root_path(),
|
||||
redis_mapping)
|
||||
if not jsonset:
|
||||
raise RedisException(f"Failed to store {lyr_result.artist} - {lyr_result.song} (SQLite id: {sqlite_id}):\n{jsonset}")
|
||||
raise RedisException(f"Failed to store {lyr_result.artist} - {lyr_result.song} (SQLite id: {sqlite_id}) to redis:\n{jsonset}")
|
||||
logging.info("Stored %s - %s (related SQLite Row ID: %s) to %s",
|
||||
lyr_result.artist, lyr_result.song, sqlite_id, newkey)
|
||||
await self.notifier.send("INFO",
|
||||
f"Stored {lyr_result.artist} - {lyr_result.song} (related SQLite Row ID: {sqlite_id}) to {newkey}")
|
||||
f"Stored {lyr_result.artist} - {lyr_result.song} (related SQLite Row ID: {sqlite_id}) to redis: {newkey}")
|
||||
except Exception as e:
|
||||
await self.notifier.send(f"ERROR @ {__file__.rsplit("/", maxsplit=1)[-1]}",
|
||||
f"Failed to store {lyr_result.artist} - {lyr_result.song}\
|
||||
|
||||
Reference in New Issue
Block a user