forked from Walkover-Web-Solution/gtwy-ai
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathglobals.py
More file actions
21 lines (15 loc) · 697 Bytes
/
globals.py
File metadata and controls
21 lines (15 loc) · 697 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from src.services.utils.logger import logger
from exceptions.bad_request import BadRequestException
import traceback
import asyncio
async def try_catch(fn, *args, **kwargs):
try:
return await fn(*args, **kwargs)
except Exception as e:
return None
REDIS_SEMAPHORE = asyncio.Semaphore(200)
MONGO_SEMAPHORE = asyncio.Semaphore(50)
# Global dictionary to track transfer history for each request
# Structure: {request_id: [{'bridge_id': ..., 'history_params': ..., 'dataset': ..., 'version_id': ..., 'thread_info': ...}]}
TRANSFER_HISTORY = {}
__all__ = ['logger', 'BadRequestException', 'traceback', 'try_catch', 'REDIS_SEMAPHORE', 'MONGO_SEMAPHORE', 'TRANSFER_HISTORY']