Skip to content

Commit

Permalink
do not require redis for read operations
Browse files Browse the repository at this point in the history
  • Loading branch information
northdpole committed Jul 29, 2024
1 parent 6a2b2c4 commit 1df79d8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 2 additions & 1 deletion application/utils/gap_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,15 @@ def get_next_id(step, previous_id):

# database is of type Node_collection, cannot annotate due to circular import
def schedule(standards: List[str], database):
conn = redis.connect()
standards_hash = make_resources_key(standards)
if database.gap_analysis_exists(
standards_hash
): # easiest, it's been calculated and cached, get it from the db
return flask_json.loads(database.get_gap_analysis_result(standards_hash))

logger.info(f"Gap analysis result for {standards_hash} does not exist")

conn = redis.connect()
gap_analysis_results = conn.get(standards_hash)
if (
gap_analysis_results
Expand Down
3 changes: 1 addition & 2 deletions application/web/web_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from typing import Any
from application.utils import oscal_utils, redis

from rq import Queue, job, exceptions
from rq import job, exceptions

from application.database import db
from application.defs import cre_defs as defs
Expand All @@ -23,7 +23,6 @@
from flask import (
Blueprint,
abort,
current_app,
jsonify,
redirect,
request,
Expand Down

0 comments on commit 1df79d8

Please sign in to comment.