Merge pull request #420 from antville/fix-error-in-health-action

Fix error in health action during first minutes after startup
This commit is contained in:
Tobi Schäfer 2024-05-31 02:10:52 +02:00 committed by GitHub
commit 23923fd694
Failed to generate hash of commit
2 changed files with 4 additions and 4 deletions

View file

@ -85,17 +85,17 @@
<dt><% gettext Requests %></dt>
<dd>
<% gettext '{0} total' <% param.requestCount %> %>,
<% gettext '{0} in the last 5 min.' <% param.requestsPerUnit default=n.a. %> %>
<% gettext '{0} in the last 5 min.' <% param.requestsPerUnit default=0 %> %>
</dd>
<dt><% gettext 'Errors' %></dt>
<dd>
<% gettext '{0} total' <% param.errorCount %> %>,
<% gettext '{0} in the last 5 min.' <% param.errorsPerUnit default=n.a. %> %>
<% gettext '{0} in the last 5 min.' <% param.errorsPerUnit default=0 %> %>
</dd>
<dt><% gettext 'Error Ratio' %></dt>
<dd>
<% gettext '{0}% total' <% param.errorRatio %> %>,
<% gettext '{0}% in the last 5 min.' <% param.errorRatioPerUnit %> %>
<% gettext '{0}% in the last 5 min.' <% param.errorRatioPerUnit default=0 %> %>
</dd>
<dt><% gettext 'Xml-Rpc Count' %></dt>
<dd><% ngettext '{0} request' '{0} requests' <% param.xmlrpcCount %> %></dd>

View file

@ -275,11 +275,11 @@ Root.prototype.health_action = function() {
}
param.errorRatio = formatNumber(100 * app.errorCount / app.requestCount || 0);
param.errorRatioPerUnit = formatNumber(Admin.health.errorsPerUnit / Admin.health.requestsPerUnit || 0);
if (Admin.health) {
param.requestsPerUnit = formatNumber(Admin.health.requestsPerUnit);
param.errorsPerUnit = formatNumber(Admin.health.errorsPerUnit);
param.errorRatioPerUnit = formatNumber(Admin.health.errorsPerUnit / Admin.health.requestsPerUnit || 0);
}
param.callbacks = app.data.callbacks.length;