query_parts.append(f"sub_key LIKE '%{key_filter}%'")
query = "WHERE " + " AND ".join(query_parts) if query_parts else None
await self.database.delete(DB_TABLE_CACHE, query=query)
- await self.database.vacuum()
self.logger.info("Clearing database DONE")
async def auto_cleanup(self) -> None:
await self.database.delete(DB_TABLE_CACHE, {"id": db_row["id"]})
cleaned_records += 1
await asyncio.sleep(0) # yield to eventloop
- if cleaned_records > 50:
- self.logger.debug("Compacting database...")
- await self.database.vacuum()
- self.logger.debug("Compacting database done")
self.logger.debug("Automatic cleanup finished (cleaned up %s records)", cleaned_records)
async def _setup_database(self) -> None:
{"key": "version", "value": str(DB_SCHEMA_VERSION), "type": "str"},
)
await self.__create_database_indexes()
- # compact db
+ # compact db (vacuum) at startup
self.logger.debug("Compacting database...")
try:
await self.database.vacuum()
try:
async for chunk in TimedAsyncGenerator(self.audio_input, 300):
audio_received = True
+ if self.proc and self.proc.returncode is not None:
+ raise AudioError("Parent process already exited")
await self.write(chunk)
generator_exhausted = True
if not audio_received: