Skip to content

Commit

Permalink
fix(healthz): use updated syntax to make SELECT 1 call to the DB (#90)
Browse files Browse the repository at this point in the history
Co-authored-by: Matt Wise <[email protected]>
  • Loading branch information
diranged and diranged authored Oct 22, 2024
1 parent ebbe2c3 commit 0834b07
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/gogo.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import auth
from base_list_view import BaseListView
from models import Shortcut, db
from sqlalchemy.sql import text

# Shortcuts may not use these names.
RESERVED_NAMES = {"_create", "_delete", "_edit", "_list", "_ajax"}
Expand Down Expand Up @@ -173,7 +174,7 @@ def get(self, name):
formatted_url = _replace_placeholders(str(shortcut.secondary_url), secondary_arg)
if not formatted_url:
flask.abort(400)

response = flask.make_response(
flask.redirect(formatted_url)
)
Expand All @@ -194,7 +195,7 @@ def get(self, name):
class Healthz(MethodView):
def get(self):
try:
db.engine.execute("SELECT 1")
db.session.execute(text("SELECT 1"))
return "OK"
except Exception as e:
logging.getLogger(__name__).error("Healthz failed: %s", e)
Expand Down

0 comments on commit 0834b07

Please sign in to comment.