Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Allow heartbeat to report node status #426

Merged
merged 1 commit into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions horde/apis/v2/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2644,13 +2644,17 @@ class Heartbeat(Resource):
def get(self):
"""If this loads, this node is available
Includes some other metrics to gauge the health of this node"""
db_conn = True
health = 'OK'
db_conn = True
try:
db.session.execute(text("SELECT 1"))
except Exception:
db_conn = False
health = 'DOWN'
if waitress_metrics.queue > 0:
health = 'OVERLOADED'
return {
"message": "OK",
"message": health,
"version": HORDE_VERSION,
"queue": waitress_metrics.queue,
"threads": waitress_metrics.threads,
Expand Down
2 changes: 1 addition & 1 deletion horde/consts.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
HORDE_VERSION = "4.38.0"
HORDE_VERSION = "4.38.1"

WHITELISTED_SERVICE_IPS = {
"212.227.227.178", # Turing Bot
Expand Down
Loading