fix: resolve 13 important issues from code review
I1: Add graceful shutdown (SIGTERM/SIGINT) to all 5 background services I2: Fix Dockerfile healthcheck to use curl on /metrics endpoint I3: Fix StreamConsumer.ensure_group() to only catch BUSYGROUP errors I4: Fix SimulatedBroker to reject orders with insufficient cash/shares I5: Move ORM attribute access inside DB session context in trades routes I6: Add Redis-based rate limiting (10 req/min/IP) on all auth endpoints I8: Prevent backtest background task garbage collection I9: Use Numeric(16,6) instead of Float for financial columns in migration I10: Add index on trades.created_at for time-range queries I11: Bind infrastructure ports to 127.0.0.1 in docker-compose I12: Add migrations init service; all app services depend on it I13: Fix user enumeration in login_begin (return options for non-existent users)
This commit is contained in:
parent
2a56727267
commit
5a6b20c8f1
13 changed files with 355 additions and 188 deletions
|
|
@ -40,9 +40,12 @@ class StreamConsumer:
|
|||
try:
|
||||
await self.redis.xgroup_create(self.stream, self.group, id="0", mkstream=True)
|
||||
logger.info("Created consumer group %s on %s", self.group, self.stream)
|
||||
except Exception:
|
||||
# Group already exists — this is expected on subsequent starts.
|
||||
pass
|
||||
except Exception as exc:
|
||||
# BUSYGROUP means group already exists — expected on subsequent starts.
|
||||
if "BUSYGROUP" in str(exc):
|
||||
logger.debug("Consumer group %s already exists on %s", self.group, self.stream)
|
||||
else:
|
||||
raise
|
||||
|
||||
async def consume(
|
||||
self, batch_size: int = 10, block_ms: int = 5000
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue