From d435322ee7fb5869c058d7be5bf7368a93569a06 Mon Sep 17 00:00:00 2001 From: Kenneth Kehl <@kkehl@flexion.us> Date: Fri, 26 Sep 2025 10:21:25 -0700 Subject: [PATCH] try flask caching to get around SQLAlchemy problem with cachetools --- app/job/rest.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/job/rest.py b/app/job/rest.py index 1e8ee19d8..28f25a115 100644 --- a/app/job/rest.py +++ b/app/job/rest.py @@ -1,7 +1,8 @@ from zoneinfo import ZoneInfo import dateutil -from flask import Blueprint, current_app, jsonify, request +from flask import Blueprint, app, current_app, jsonify, request +from flask_caching import Cache from app import db from app.aws.s3 import ( @@ -43,11 +44,13 @@ from app.utils import check_suspicious_id, hilite, midnight_n_days_ago, paginati job_blueprint = Blueprint("job", __name__, url_prefix="/service//job") - +cache = Cache(config={"CACHE_TYPE": "SimpleCache"}) +cache.init_app(app) register_errors(job_blueprint) @job_blueprint.route("/", methods=["GET"]) +@cache.cached(timeout=30) def get_job_by_service_and_job_id(service_id, job_id): current_app.logger.info(hilite("ENTER get_job_by_service_and_job_id")) check_suspicious_id(service_id, job_id)