fix: harden kyc startup and beorg errors

This commit is contained in:
2026-06-28 14:12:24 +03:00
parent 08fdd92060
commit 6f1912261a
3 changed files with 21 additions and 7 deletions

View File

@@ -84,10 +84,12 @@ async def lifespan(app: FastAPI) -> AsyncGenerator[None, None]:
app.state.jwt_key_store = jwt_store
app.state.jwt_keys_scheduler = jwt_scheduler
app.state.kyc_scheduler = kyc_scheduler
yield
app.state.kyc_scheduler.shutdown(wait=False)
app.state.jwt_keys_scheduler.shutdown(wait=False)
logger.info(f'Users service instance ended with id {instance_id}')
try:
yield
finally:
app.state.kyc_scheduler.shutdown(wait=False)
app.state.jwt_keys_scheduler.shutdown(wait=False)
logger.info(f'KYC service instance ended with id {instance_id}')
app: FastAPI = FastAPI(
@@ -126,7 +128,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=['*'],