Added Ruff linting
This commit is contained in:
1 parent
aa612103f4
commit
b3c16f78d6
5 files changed
+34
-5
No files matched your search
+2
-2
@@ -106,10 +106,10 @@ async def pull_notifications(
|
||||
)
|
||||
except (AMQPException, OSError) as e:
|
||||
logger.error(f"[FastAPI] RabbitMQ unavailable for user_id={user_id}: {e}")
|
||||
raise HTTPException(status_code=503, detail="Message broker unavailable")
|
||||
raise HTTPException(status_code=503, detail="Message broker unavailable") from e
|
||||
except RuntimeError as e:
|
||||
logger.error(f"[FastAPI] Consumer not ready: {e}")
|
||||
raise HTTPException(status_code=503, detail="Service not ready")
|
||||
raise HTTPException(status_code=503, detail="Service not ready") from e
|
||||
|
||||
logger.info(f"[FastAPI] Retrieved {len(messages)} message(s) for user_id={user_id}")
|
||||
return PullResponse(messages=messages, count=len(messages), has_more=len(messages) >= MAX_MESSAGES)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from fastapi import FastAPI, Response
|
||||
from prometheus_client import generate_latest, CONTENT_TYPE_LATEST, Counter
|
||||
from prometheus_client import CONTENT_TYPE_LATEST, Counter, generate_latest
|
||||
|
||||
metrics_api = FastAPI(title="Metrics Server", description="Prometheus metrics endpoint")
|
||||
|
||||
|
||||
@@ -78,11 +78,11 @@ class RabbitMQConsumer:
|
||||
|
||||
- Only one fetch per user runs at a time; different users run concurrently.
|
||||
- Messages are acked after the whole batch has been read, so an error mid-read
|
||||
puts the batch back on the queue and re-raises.
|
||||
puts the batch back on the queue and re-raises.
|
||||
- Undecodable messages are rejected without requeue (discarded).
|
||||
- Returns an empty list if nothing is queued.
|
||||
- Delivery is at-most-once towards the client: messages are acked before the
|
||||
HTTP response is sent.
|
||||
HTTP response is sent.
|
||||
"""
|
||||
|
||||
if self._closing:
|
||||
|
||||
Reference in new issue
Block a user