mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-29 20:16:44 +00:00
Adds 'outstanding task count' to the health API endpoint (#3920)
This commit is contained in:
parent
03017b531a
commit
6eeb983f1d
@ -6,6 +6,7 @@ from django.http import JsonResponse
|
|||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
from django_filters.rest_framework import DjangoFilterBackend
|
from django_filters.rest_framework import DjangoFilterBackend
|
||||||
|
from django_q.models import OrmQ
|
||||||
from rest_framework import filters, permissions
|
from rest_framework import filters, permissions
|
||||||
from rest_framework.response import Response
|
from rest_framework.response import Response
|
||||||
from rest_framework.serializers import ValidationError
|
from rest_framework.serializers import ValidationError
|
||||||
@ -28,6 +29,11 @@ class InfoView(AjaxView):
|
|||||||
|
|
||||||
permission_classes = [permissions.AllowAny]
|
permission_classes = [permissions.AllowAny]
|
||||||
|
|
||||||
|
def worker_pending_tasks(self):
|
||||||
|
"""Return the current number of outstanding background tasks"""
|
||||||
|
|
||||||
|
return OrmQ.objects.count()
|
||||||
|
|
||||||
def get(self, request, *args, **kwargs):
|
def get(self, request, *args, **kwargs):
|
||||||
"""Serve current server information."""
|
"""Serve current server information."""
|
||||||
data = {
|
data = {
|
||||||
@ -36,6 +42,7 @@ class InfoView(AjaxView):
|
|||||||
'instance': inventreeInstanceName(),
|
'instance': inventreeInstanceName(),
|
||||||
'apiVersion': inventreeApiVersion(),
|
'apiVersion': inventreeApiVersion(),
|
||||||
'worker_running': is_worker_running(),
|
'worker_running': is_worker_running(),
|
||||||
|
'worker_pending_tasks': self.worker_pending_tasks(),
|
||||||
'plugins_enabled': settings.PLUGINS_ENABLED,
|
'plugins_enabled': settings.PLUGINS_ENABLED,
|
||||||
'active_plugins': plugins_info(),
|
'active_plugins': plugins_info(),
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user