Browse Source

prevent too many concurrent debug.log i/o in KMD native mode

master
Petr Balashov 8 years ago
parent
commit
5770013bad
  1. 68
      assets/scripts/kmd_wallet/KMDInit.js
  2. 7
      assets/scripts/lang/en.js

68
assets/scripts/kmd_wallet/KMDInit.js

@ -1,3 +1,13 @@
var chainActivationLastUpdate,
chainActivationLastUpdateTimeout = 1;
function checkTimestamp(dateToCheck) {
var currentEpochTime = new Date(Date.now()) / 1000,
secondsElapsed = Number(currentEpochTime) - Number(dateToCheck / 1000);
return Math.floor(secondsElapsed);
}
function RunKMDInitFunctions() {
NProgress.done(true);
NProgress.configure({
@ -87,38 +97,40 @@ function RunKMDInitFunctions() {
var currentBestBlockInterval;
function startBestBlockInterval() {
currentBestBlockInterval = setInterval(function() {
$.ajax({
type: 'POST',
data: {
'herdname': 'komodo',
'lastLines': 1
},
url: 'http://127.0.0.1:17777/shepherd/debuglog',
success: function(data, textStatus, jqXHR) {
if (data.indexOf('UpdateTip') > -1) {
var temp = data.split(' ');
for (var i = 0; i < temp.length; i++) {
if (temp[i].indexOf('height=') > -1) {
var currentBestChain = temp[i].replace('height=', '');
$('#activating-komodod-tridot').hide();
$('#activating-komodod-progress').html(': ' + Math.floor(currentBestChain * 100 / totalBlocksInExplorer) + '% (blocks ' + currentBestChain + ' / ' + totalBlocksInExplorer + ')');
if (currentBestChain === totalBlocksInExplorer) {
//clearInterval(totalBlocksInExplorerInterval);
clearInterval(currentBestBlockInterval);
if (!chainActivationLastUpdate || checkTimestamp(chainActivationLastUpdate) > chainActivationLastUpdateTimeout) {
$.ajax({
type: 'POST',
data: {
'herdname': 'komodo',
'lastLines': 1
},
url: 'http://127.0.0.1:17777/shepherd/debuglog',
success: function(data, textStatus, jqXHR) {
if (data.indexOf('UpdateTip') > -1) {
var temp = data.split(' ');
for (var i = 0; i < temp.length; i++) {
if (temp[i].indexOf('height=') > -1) {
var currentBestChain = temp[i].replace('height=', '');
$('#activating-komodod-tridot').hide();
$('#activating-komodod-progress').html(': ' + Math.floor(currentBestChain * 100 / totalBlocksInExplorer) + '% (blocks ' + currentBestChain + ' / ' + totalBlocksInExplorer + ')');
chainActivationLastUpdate = Date.now();
if (currentBestChain === totalBlocksInExplorer) {
//clearInterval(totalBlocksInExplorerInterval);
clearInterval(currentBestBlockInterval);
}
}
}
}
},
error: function(xhr, textStatus, error) {
console.log('failed getting debug.log');
console.log(xhr.statusText);
console.log(textStatus);
console.log(error);
}
},
error: function(xhr, textStatus, error) {
console.log('failed getting debug.log');
console.log(xhr.statusText);
console.log(textStatus);
console.log(error);
}
});
});
}
}, 2000);
}

7
assets/scripts/lang/en.js

@ -148,8 +148,8 @@ const _lang = {
'FIAT_CURRENCY': 'Fiat Currency',
'EXPORT_KEYS': 'Export Keys',
'ONLY_ACTIVE_WIF_KEYS': 'Only the active coin wallet wif keys will be shown here.<br/>' +
'If you don\'t see a wif key for the coin you are looking for please active it by adding it from EasyDEX Dashboard.<br/>' +
'You can use these wif keys to import to another coin wallets.',
'If you don\'t see a wif key for the coin you are looking for please active it by adding it from EasyDEX Dashboard.<br/>' +
'You can use these wif keys to import to another coin wallets.',
'PLEASE_KEEP_KEYS_SAFE': 'Please keep these keys extra safe and secure.',
'PASSPHRASE': 'Passphrase',
'GET_WIF_KEYS': 'Get Wif Keys',
@ -194,7 +194,7 @@ const _lang = {
'FETCHING_DATA': 'Fetching Data. Please wait for a minute to complete this task.',
'LESS_RESPONSES_REQ': 'Less than required responses. Please try again.',
'SWITCHED_TO': 'switched to',
'MODE': 'Mode',
'MODE': 'Mode',
'TX_SENT': 'Transaction Sent',
'TX_SEND_ERR': 'Unable to complete transaction',
'LOOKS_LIKE': 'Looks like',
@ -272,7 +272,6 @@ const _lang = {
},
'SETTINGS': {
'PASSPHRASE_REQ': 'Passphrase is required.',
}
}
};
Loading…
Cancel
Save