Skip to content

Commit

Permalink
REF: Factor out question acknowledgement response in flask app
Browse files Browse the repository at this point in the history
  • Loading branch information
cortadocodes committed Jun 28, 2024
1 parent 8d17744 commit c1839e8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions octue/cloud/deployment/google/cloud_run/flask_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
app = Flask(__name__)


QUESTION_ACKNOWLEDGMENT_RESPONSE = ("", 204)


@app.route("/", methods=["POST"])
def index():
"""Receive questions from Google Cloud Run in the form of Google Pub/Sub messages.
Expand Down Expand Up @@ -41,7 +44,7 @@ def index():

project_name = envelope["subscription"].split("/")[1]
answer_question(question=question, project_name=project_name)
return ("", 204)
return QUESTION_ACKNOWLEDGMENT_RESPONSE


def _log_bad_request_and_return_400_response(message):
Expand Down Expand Up @@ -101,4 +104,4 @@ def _acknowledge_and_drop_redelivered_questions(question_uuid, retry_count):
question_uuid,
retry_count,
)
return ("", 204)
return QUESTION_ACKNOWLEDGMENT_RESPONSE

0 comments on commit c1839e8

Please sign in to comment.