[ADDED] Possibility to disable navbar live updates
* Added new admin options: disable_navbar and disable_navbar_api * Removes LIVE STATS from navigation list * Removes live updates on Pool General Statistics page * Added system load checks to getnavbardata API call This will help to decrease load on high-volume servers at the cost of losing live status. Fixes #1014 once merged.
This commit is contained in:
parent
ba625e100e
commit
9485b3f9d6
@ -287,6 +287,20 @@ $aSettings['system'][] = array(
|
|||||||
'name' => 'disable_dashboard_api', 'value' => $setting->getValue('disable_dashboard_api'),
|
'name' => 'disable_dashboard_api', 'value' => $setting->getValue('disable_dashboard_api'),
|
||||||
'tooltip' => 'Disable dashboard API entirely to reduce server load.'
|
'tooltip' => 'Disable dashboard API entirely to reduce server load.'
|
||||||
);
|
);
|
||||||
|
$aSettings['system'][] = array(
|
||||||
|
'display' => 'Disable Live Navbar', 'type' => 'select',
|
||||||
|
'options' => array( 0 => 'No', 1 => 'Yes'),
|
||||||
|
'default' => 0,
|
||||||
|
'name' => 'disable_navbar', 'value' => $setting->getValue('disable_navbar'),
|
||||||
|
'tooltip' => 'Disable live updates on the navbar to reduce server load.'
|
||||||
|
);
|
||||||
|
$aSettings['system'][] = array(
|
||||||
|
'display' => 'Disable Navbar API', 'type' => 'select',
|
||||||
|
'options' => array( 0 => 'No', 1 => 'Yes'),
|
||||||
|
'default' => 0,
|
||||||
|
'name' => 'disable_navbar_api', 'value' => $setting->getValue('disable_navbar_api'),
|
||||||
|
'tooltip' => 'Disable navbar API entirely to reduce server load. Used in pool stats and navbar mini stats.'
|
||||||
|
);
|
||||||
$aSettings['system'][] = array(
|
$aSettings['system'][] = array(
|
||||||
'display' => 'Disable TX Summaries', 'type' => 'select',
|
'display' => 'Disable TX Summaries', 'type' => 'select',
|
||||||
'options' => array( 0 => 'No', 1 => 'Yes'),
|
'options' => array( 0 => 'No', 1 => 'Yes'),
|
||||||
|
|||||||
@ -3,8 +3,19 @@
|
|||||||
// Make sure we are called from index.php
|
// Make sure we are called from index.php
|
||||||
if (!defined('SECURITY')) die('Hacking attempt');
|
if (!defined('SECURITY')) die('Hacking attempt');
|
||||||
|
|
||||||
// Check if the API is activated
|
// Check if the system is enabled
|
||||||
$api->isActive();
|
if ($setting->getValue('disable_navbar_api')) {
|
||||||
|
echo $api->get_json(array('error' => 'disabled'));
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
|
||||||
|
// System load check
|
||||||
|
if ($load = @sys_getloadavg()) {
|
||||||
|
if (isset($config['system']['load']['max']) && $load[0] > $config['system']['load']['max']) {
|
||||||
|
header('HTTP/1.1 503 Too busy, try again later');
|
||||||
|
die('Server too busy. Please try again later.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Fetch RPC information
|
// Fetch RPC information
|
||||||
if ($bitcoin->can_connect() === true) {
|
if ($bitcoin->can_connect() === true) {
|
||||||
|
|||||||
@ -65,6 +65,8 @@ $aGlobal = array(
|
|||||||
'price' => $setting->getValue('price'),
|
'price' => $setting->getValue('price'),
|
||||||
'disable_payouts' => $setting->getValue('disable_payouts'),
|
'disable_payouts' => $setting->getValue('disable_payouts'),
|
||||||
'config' => array(
|
'config' => array(
|
||||||
|
'disable_navbar' => $setting->getValue('disable_navbar'),
|
||||||
|
'disable_navbar_api' => $setting->getValue('disable_navbar_api'),
|
||||||
'algorithm' => $config['algorithm'],
|
'algorithm' => $config['algorithm'],
|
||||||
'target_bits' => $config['target_bits'],
|
'target_bits' => $config['target_bits'],
|
||||||
'accounts' => $config['accounts'],
|
'accounts' => $config['accounts'],
|
||||||
|
|||||||
@ -88,6 +88,7 @@
|
|||||||
{if $smarty.session.AUTHENTICATED|default:"0" == 1}
|
{if $smarty.session.AUTHENTICATED|default:"0" == 1}
|
||||||
<br />
|
<br />
|
||||||
{else}
|
{else}
|
||||||
|
{if !$GLOBAL.website.api.disabled && !$GLOBAL.config.disable_navbar && !$GLOBAL.config.disable_navbar_api}
|
||||||
<ul>
|
<ul>
|
||||||
<center>
|
<center>
|
||||||
<div style="display: inline-block;">
|
<div style="display: inline-block;">
|
||||||
@ -100,3 +101,4 @@
|
|||||||
<hr/>
|
<hr/>
|
||||||
{include file="global/navjs.tpl"}
|
{include file="global/navjs.tpl"}
|
||||||
{/if}
|
{/if}
|
||||||
|
{/if}
|
||||||
|
|||||||
@ -10,46 +10,43 @@ $(document).ready(function(){
|
|||||||
var storedHashrate=[];
|
var storedHashrate=[];
|
||||||
var storedWorkers=[];
|
var storedWorkers=[];
|
||||||
|
|
||||||
// Helper to initilize gauges
|
g1 = new JustGage({
|
||||||
function initGauges(data) {
|
id: "mr",
|
||||||
|
value: parseFloat({/literal}{$GLOBAL.workers}{literal}).toFixed(0),
|
||||||
|
min: 0,
|
||||||
|
max: Math.round({/literal}{$GLOBAL.workers}{literal} * 2),
|
||||||
|
title: "Miners",
|
||||||
|
gaugeColor: '#6f7a8a',
|
||||||
|
labelFontColor: '#555',
|
||||||
|
titleFontColor: '#555',
|
||||||
|
valueFontColor: '#555',
|
||||||
|
label: "Active Miners",
|
||||||
|
relativeGaugeSize: true,
|
||||||
|
showMinMax: true,
|
||||||
|
shadowOpacity : 0.8,
|
||||||
|
shadowSize : 0,
|
||||||
|
shadowVerticalOffset : 10
|
||||||
|
});
|
||||||
|
|
||||||
g1 = new JustGage({
|
g2 = new JustGage({
|
||||||
id: "mr",
|
id: "hr",
|
||||||
value: parseFloat(data.getnavbardata.data.pool.workers).toFixed(0),
|
value: parseFloat({/literal}{$GLOBAL.hashrate}{literal}).toFixed(2),
|
||||||
min: 0,
|
min: 0,
|
||||||
max: Math.round(data.getnavbardata.data.pool.workers * 4),
|
max: Math.round({/literal}{$GLOBAL.hashrate}{literal} * 2),
|
||||||
title: "Miners",
|
title: "Pool Hashrate",
|
||||||
gaugeColor: '#6f7a8a',
|
gaugeColor: '#6f7a8a',
|
||||||
labelFontColor: '#555',
|
labelFontColor: '#555',
|
||||||
titleFontColor: '#555',
|
titleFontColor: '#555',
|
||||||
valueFontColor: '#555',
|
valueFontColor: '#555',
|
||||||
label: "Active Miners",
|
label: "{/literal}{$GLOBAL.hashunits.pool}{literal}",
|
||||||
relativeGaugeSize: true,
|
relativeGaugeSize: true,
|
||||||
showMinMax: true,
|
showMinMax: true,
|
||||||
shadowOpacity : 0.8,
|
shadowOpacity : 0.8,
|
||||||
shadowSize : 0,
|
shadowSize : 0,
|
||||||
shadowVerticalOffset : 10
|
shadowVerticalOffset : 10
|
||||||
});
|
});
|
||||||
|
|
||||||
g2 = new JustGage({
|
|
||||||
id: "hr",
|
|
||||||
value: parseFloat(data.getnavbardata.data.pool.hashrate).toFixed(2),
|
|
||||||
min: 0,
|
|
||||||
max: Math.round(data.getnavbardata.data.pool.hashrate * 4),
|
|
||||||
title: "Pool Hashrate",
|
|
||||||
gaugeColor: '#6f7a8a',
|
|
||||||
labelFontColor: '#555',
|
|
||||||
titleFontColor: '#555',
|
|
||||||
valueFontColor: '#555',
|
|
||||||
label: "{/literal}{$GLOBAL.hashunits.pool}{literal}",
|
|
||||||
relativeGaugeSize: true,
|
|
||||||
showMinMax: true,
|
|
||||||
shadowOpacity : 0.8,
|
|
||||||
shadowSize : 0,
|
|
||||||
shadowVerticalOffset : 10
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
{/literal}{if $GLOBAL.config.disable_navbar|default:"0" != 1 && $GLOBAL.config.disable_navbar_api|default:"0" != 1}{literal}
|
||||||
// Helper to refresh graphs
|
// Helper to refresh graphs
|
||||||
function refreshInformation(data) {
|
function refreshInformation(data) {
|
||||||
g1.refresh(parseFloat(data.getnavbardata.data.pool.workers).toFixed(0));
|
g1.refresh(parseFloat(data.getnavbardata.data.pool.workers).toFixed(0));
|
||||||
@ -61,14 +58,6 @@ $(document).ready(function(){
|
|||||||
storedHashrate[storedHashrate.length] = [timeNow, data.getnavbardata.data.raw.pool.hashrate];
|
storedHashrate[storedHashrate.length] = [timeNow, data.getnavbardata.data.raw.pool.hashrate];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fetch initial data via Ajax, starts proper gauges to display
|
|
||||||
$.ajax({
|
|
||||||
url: url,
|
|
||||||
async: false, // Run all others requests after this only if it's done
|
|
||||||
dataType: 'json',
|
|
||||||
success: function (data) { initGauges(data); }
|
|
||||||
});
|
|
||||||
|
|
||||||
// Our worker process to keep gauges and graph updated
|
// Our worker process to keep gauges and graph updated
|
||||||
(function worker() {
|
(function worker() {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
@ -81,6 +70,7 @@ $(document).ready(function(){
|
|||||||
setTimeout(worker, {/literal}{($GLOBAL.config.statistics_ajax_refresh_interval * 1000)|default:"1000"}{literal})
|
setTimeout(worker, {/literal}{($GLOBAL.config.statistics_ajax_refresh_interval * 1000)|default:"1000"}{literal})
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
{/literal}{/if}{literal}
|
||||||
})();
|
})();
|
||||||
});
|
});
|
||||||
{/literal}
|
{/literal}
|
||||||
|
|||||||
@ -6,6 +6,6 @@
|
|||||||
|
|
||||||
{include file="statistics/blocks/small_table.tpl" ALIGN="right" SHORT=true}
|
{include file="statistics/blocks/small_table.tpl" ALIGN="right" SHORT=true}
|
||||||
|
|
||||||
{if !$GLOBAL.website.api.disabled}
|
{if !$GLOBAL.website.api.disabled && !$GLOBAL.config.disable_navbar && !$GLOBAL.config.disable_navbar_api}
|
||||||
{include file="statistics/js.tpl"}
|
{include file="statistics/js.tpl"}
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user