Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
1eb8b3a9
Unverified
Commit
1eb8b3a9
authored
7 years ago
by
John Eskew
Committed by
GitHub
7 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #17147 from open-craft/clemente/add-forum-to-heartbeat
Allow to include forum status in LMS heartbeat service.
parents
381af53a
ce461b1d
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lms/lib/comment_client/utils.py
+28
-0
28 additions, 0 deletions
lms/lib/comment_client/utils.py
with
28 additions
and
0 deletions
lms/lib/comment_client/utils.py
+
28
−
0
View file @
1eb8b3a9
...
...
@@ -8,6 +8,7 @@ import requests
from
django.utils.translation
import
get_language
import
dogstats_wrapper
as
dog_stats_api
from
.settings
import
SERVICE_HOST
as
COMMENTS_SERVICE
log
=
logging
.
getLogger
(
__name__
)
...
...
@@ -171,3 +172,30 @@ class CommentClientPaginatedResult(object):
self
.
num_pages
=
num_pages
self
.
thread_count
=
thread_count
self
.
corrected_text
=
corrected_text
def
check_forum_heartbeat
():
"""
Check the forum connection via its built-in heartbeat service and create an answer which can be used in the LMS
heartbeat django application.
This function can be connected to the LMS heartbeat checker through the HEARTBEAT_CHECKS variable.
"""
# To avoid dependency conflict
from
django_comment_common.models
import
ForumsConfig
config
=
ForumsConfig
.
current
()
if
not
config
.
enabled
:
# If this check is enabled but forums disabled, don't connect, just report no error
return
'
forum
'
,
True
,
'
OK
'
try
:
res
=
requests
.
get
(
'
%s/heartbeat
'
%
COMMENTS_SERVICE
,
timeout
=
config
.
connection_timeout
).
json
()
if
res
[
'
OK
'
]:
return
'
forum
'
,
True
,
'
OK
'
else
:
return
'
forum
'
,
False
,
res
.
get
(
'
check
'
,
'
Forum heartbeat failed
'
)
except
Exception
as
fail
:
return
'
forum
'
,
False
,
unicode
(
fail
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment