fix: harden wallet balances and service startup

This commit is contained in:
2026-06-28 14:12:23 +03:00
parent bf8d778a9f
commit 73b5922c97
4 changed files with 55 additions and 12 deletions

View File

@@ -74,8 +74,13 @@ async def lifespan(app: FastAPI) -> AsyncGenerator[None, None]:
path=settings.VAULT_CRYPTO_MASTER_KEY_PATH,
)
logger.info('Crypto master key loaded from Vault')
yield
logger.info(f'B2B service instance ended with id {instance_id}')
try:
yield
finally:
sched = getattr(app.state,'jwt_keys_scheduler',None)
if sched:
sched.shutdown(wait=False)
logger.info(f'B2B service instance ended with id {instance_id}')
app: FastAPI = FastAPI(
@@ -111,7 +116,7 @@ app.add_middleware(
app.add_middleware(
CORSMiddleware,
allow_origins=[],
allow_origin_regex='.*',
allow_origin_regex=settings.CORS_ALLOW_ORIGIN_REGEX,
allow_credentials=True,
allow_methods=['*'],
allow_headers=['*'],