chore: only import catalogue if needed
Some checks failed
PR tests / build-and-smoke (pull_request) Failing after 1m20s

This commit is contained in:
2025-11-25 09:23:29 +01:00
parent e1da6085ed
commit 6f38dd482e

View File

@@ -5,7 +5,7 @@ This can run independently to support the PHP application
import os
import re
from bibapi import catalogue
# Avoid importing heavy modules at top-level to keep `import api_service` lightweight
from fastapi import FastAPI, Query
from fastapi.middleware.cors import CORSMiddleware
from fastapi.responses import JSONResponse
@@ -28,7 +28,9 @@ cat = None
def _get_catalogue():
global cat
if cat is None:
cat = catalogue.Catalogue()
# import inside function to avoid expensive work during module import
from bibapi import catalogue as _catalogue
cat = _catalogue.Catalogue()
return cat