remove widget endpoints from docs/schema, add logging/notify for failed lyr storage
This commit is contained in:
parent
e55485e7e8
commit
85a7440c67
@ -32,7 +32,8 @@ class Misc(FastAPI):
|
|||||||
}
|
}
|
||||||
|
|
||||||
for endpoint, handler in self.endpoints.items():
|
for endpoint, handler in self.endpoints.items():
|
||||||
app.add_api_route(f"/{endpoint}/", handler, methods=["GET"])
|
app.add_api_route(f"/{endpoint}/", handler, methods=["GET"],
|
||||||
|
include_in_schema=False)
|
||||||
|
|
||||||
async def get_radio_np(self) -> dict:
|
async def get_radio_np(self) -> dict:
|
||||||
"""
|
"""
|
||||||
|
@ -12,7 +12,7 @@ sys.path.insert(1,'.')
|
|||||||
from typing import Optional, Any
|
from typing import Optional, Any
|
||||||
import aiosqlite as sqlite3
|
import aiosqlite as sqlite3
|
||||||
from . import redis_cache
|
from . import redis_cache
|
||||||
from lyric_search_new import utils
|
from lyric_search_new import utils, notifier
|
||||||
from lyric_search_new.constructors import LyricsResult
|
from lyric_search_new.constructors import LyricsResult
|
||||||
|
|
||||||
|
|
||||||
@ -27,6 +27,7 @@ class Cache:
|
|||||||
"lib", "singerdbs",
|
"lib", "singerdbs",
|
||||||
"cached_lyrics.db")
|
"cached_lyrics.db")
|
||||||
self.redis_cache = redis_cache.RedisCache()
|
self.redis_cache = redis_cache.RedisCache()
|
||||||
|
self.notifier = notifier.DiscordNotifier()
|
||||||
|
|
||||||
self.cache_pre_query: str = "pragma journal_mode = WAL; pragma synchronous = normal;\
|
self.cache_pre_query: str = "pragma journal_mode = WAL; pragma synchronous = normal;\
|
||||||
pragma temp_store = memory; pragma mmap_size = 30000000000;"
|
pragma temp_store = memory; pragma mmap_size = 30000000000;"
|
||||||
@ -108,10 +109,16 @@ class Cache:
|
|||||||
Returns: None
|
Returns: None
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
try:
|
||||||
sqlite_insert_id = await self.sqlite_store(lyr_result)
|
sqlite_insert_id = await self.sqlite_store(lyr_result)
|
||||||
if sqlite_insert_id:
|
if sqlite_insert_id:
|
||||||
await self.redis_cache.redis_store(sqlite_insert_id, lyr_result)
|
await self.redis_cache.redis_store(sqlite_insert_id, lyr_result)
|
||||||
|
except Exception as e:
|
||||||
|
traceback.print_exc()
|
||||||
|
logging.error("ERROR @ %s: %s",
|
||||||
|
__file__.rsplit("/", maxsplit=1)[-1], f"cache::store >> {str(e)}")
|
||||||
|
await self.notifier.send(f"ERROR @ {__file__.rsplit("/", maxsplit=1)[-1]}",
|
||||||
|
f"cache::store >> {str(e)}")
|
||||||
|
|
||||||
async def sqlite_rowcount(self, where: Optional[str] = None, params: Optional[tuple] = None) -> int:
|
async def sqlite_rowcount(self, where: Optional[str] = None, params: Optional[tuple] = None) -> int:
|
||||||
"""
|
"""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user