rabbitmq implemented and tested

This commit is contained in:
2025-08-17 21:14:46 +03:00
parent 9543d136aa
commit 61529f7d94
43 changed files with 5433 additions and 315 deletions

View File

@@ -455,7 +455,6 @@ class EmailServiceRunner:
redis_handler: Redis handler for Redis operations
email_service: Email service for email operations
"""
# Use MailReaderService singleton for Redis operations
self.redis_handler = redis_handler
self.email_service = email_service
self.mails = None
@@ -543,7 +542,7 @@ class EmailServiceRunner:
except Exception as e:
logger.error(f"Error processing email {mail_id}: {str(e)}")
continue
try:
self.email_service.commit()
except Exception as e:

View File

@@ -84,6 +84,11 @@ class PrismaService:
while self._loop is None:
time.sleep(0.005)
async def _lock(self):
lock = asyncio.Lock()
async with lock:
return
async def _connect(self) -> Prisma:
if self._client is not None:
return self._client
@@ -167,7 +172,7 @@ class PrismaService:
result = await table_selected.create(data=data, include=include)
# print(f"[{datetime.now()}] Create operation completed in {time.time() - start:.2f}s")
return result
async def _a_update(self, table: str, where: dict, data: dict, include: Optional[dict] = None) -> Any:
start = time.time()
async with self._asession() as db:
@@ -207,7 +212,7 @@ class PrismaService:
result = await table_selected.find_unique(where=query, include=include)
# print(f"[{datetime.now()}] Find unique query completed in {time.time() - start:.2f}s")
return result
async def _a_find_unique_or_throw(self, table: str, query: dict, include: Optional[dict] = None) -> Any:
start = time.time()
async with self._asession() as db:
@@ -229,7 +234,7 @@ class PrismaService:
if select and result:
result = {k: v for k, v in result if k in select}
return result
def find_many(
self, table: str, query: Optional[dict] = None, take: int = None, skip: int = None,
order: Optional[list[dict]] = None, select: Optional[dict] = None, include: Optional[dict] = None