FastAPI dependency to get the async Supabase client. This allows for proper dependency injection and easier testing. Returns: AsyncSupabase: The async Supabase client instance
()
| 36 | |
| 37 | |
| 38 | async def get_async_supabase(): |
| 39 | """ |
| 40 | FastAPI dependency to get the async Supabase client. |
| 41 | This allows for proper dependency injection and easier testing. |
| 42 | |
| 43 | Returns: |
| 44 | AsyncSupabase: The async Supabase client instance |
| 45 | """ |
| 46 | |
| 47 | from agentops.api.environment import SUPABASE_KEY, SUPABASE_URL |
| 48 | |
| 49 | global async_supabase |
| 50 | if async_supabase is None: |
| 51 | async with _async_supabase_lock: |
| 52 | # Check again inside the lock to prevent race conditions |
| 53 | if async_supabase is None: |
| 54 | async_supabase = AsyncSupabase(SUPABASE_URL, SUPABASE_KEY) |
| 55 | return async_supabase |
| 56 | |
| 57 | |
| 58 | # Annotated dependencies for better type hinting |
no outgoing calls
no test coverage detected
searching dependent graphs…