[UPDATE] Logfile cleanup
* [REMOVED] Do not show row headers at each cron run * [REMOVED] Extra newlines in notification cron
This commit is contained in:
parent
a343ac4047
commit
643c21d3a7
@ -33,8 +33,9 @@ if ( $bitcoin->can_connect() !== true ) {
|
|||||||
// Fetch all unconfirmed blocks
|
// Fetch all unconfirmed blocks
|
||||||
$aAllBlocks = $block->getAllUnconfirmed(max($config['network_confirmations'],$config['confirmations']));
|
$aAllBlocks = $block->getAllUnconfirmed(max($config['network_confirmations'],$config['confirmations']));
|
||||||
|
|
||||||
$log->logInfo("ID\tHeight\tBlockhash\tConfirmations");
|
$header = false;
|
||||||
foreach ($aAllBlocks as $iIndex => $aBlock) {
|
foreach ($aAllBlocks as $iIndex => $aBlock) {
|
||||||
|
!$header ? $log->logInfo("ID\tHeight\tBlockhash\tConfirmations") : $header = true;
|
||||||
$aBlockInfo = $bitcoin->getblock($aBlock['blockhash']);
|
$aBlockInfo = $bitcoin->getblock($aBlock['blockhash']);
|
||||||
// Fetch this blocks transaction details to find orphan blocks
|
// Fetch this blocks transaction details to find orphan blocks
|
||||||
$aTxDetails = $bitcoin->gettransaction($aBlockInfo['tx'][0]);
|
$aTxDetails = $bitcoin->gettransaction($aBlockInfo['tx'][0]);
|
||||||
|
|||||||
@ -42,12 +42,13 @@ if ( $bitcoin->can_connect() === true ){
|
|||||||
if (empty($aTransactions['transactions'])) {
|
if (empty($aTransactions['transactions'])) {
|
||||||
$log->logDebug('No new RPC transactions since last block');
|
$log->logDebug('No new RPC transactions since last block');
|
||||||
} else {
|
} else {
|
||||||
// Table header
|
$header = false;
|
||||||
$log->logInfo("Blockhash\t\tHeight\tAmount\tConfirmations\tDiff\t\tTime");
|
|
||||||
|
|
||||||
// Let us add those blocks as unaccounted
|
// Let us add those blocks as unaccounted
|
||||||
foreach ($aTransactions['transactions'] as $iIndex => $aData) {
|
foreach ($aTransactions['transactions'] as $iIndex => $aData) {
|
||||||
if ( $aData['category'] == 'generate' || $aData['category'] == 'immature' ) {
|
if ( $aData['category'] == 'generate' || $aData['category'] == 'immature' ) {
|
||||||
|
// Table header, printe once if we found a block
|
||||||
|
!$header ? $log->logInfo("Blockhash\t\tHeight\tAmount\tConfirmations\tDiff\t\tTime") : $header = true;
|
||||||
|
|
||||||
$aBlockRPCInfo = $bitcoin->getblock($aData['blockhash']);
|
$aBlockRPCInfo = $bitcoin->getblock($aData['blockhash']);
|
||||||
$config['reward_type'] == 'block' ? $aData['amount'] = $aData['amount'] : $aData['amount'] = $config['reward'];
|
$config['reward_type'] == 'block' ? $aData['amount'] = $aData['amount'] : $aData['amount'] = $config['reward'];
|
||||||
$aData['height'] = $aBlockRPCInfo['height'];
|
$aData['height'] = $aBlockRPCInfo['height'];
|
||||||
|
|||||||
@ -33,9 +33,9 @@ $log->logDebug(" IDLE Worker Notifications ...");
|
|||||||
// Find all IDLE workers
|
// Find all IDLE workers
|
||||||
$aWorkers = $worker->getAllIdleWorkers();
|
$aWorkers = $worker->getAllIdleWorkers();
|
||||||
if (empty($aWorkers)) {
|
if (empty($aWorkers)) {
|
||||||
$log->logDebug(" no idle workers found\n");
|
$log->logDebug(" no idle workers found");
|
||||||
} else {
|
} else {
|
||||||
$log->logInfo(" found " . count($aWorkers) . " IDLE workers\n");
|
$log->logInfo(" found " . count($aWorkers) . " IDLE workers");
|
||||||
foreach ($aWorkers as $aWorker) {
|
foreach ($aWorkers as $aWorker) {
|
||||||
$aData = $aWorker;
|
$aData = $aWorker;
|
||||||
$aData['username'] = $user->getUserName($aWorker['account_id']);
|
$aData['username'] = $user->getUserName($aWorker['account_id']);
|
||||||
@ -44,7 +44,7 @@ if (empty($aWorkers)) {
|
|||||||
$aData['email'] = $user->getUserEmail($aData['username']);
|
$aData['email'] = $user->getUserEmail($aData['username']);
|
||||||
$log->logDebug(" " . $aWorker['username'] . "...");
|
$log->logDebug(" " . $aWorker['username'] . "...");
|
||||||
if (!$notification->sendNotification($aWorker['account_id'], 'idle_worker', $aData))
|
if (!$notification->sendNotification($aWorker['account_id'], 'idle_worker', $aData))
|
||||||
$log->logDebug(" Failed sending notifications: " . $notification->getCronError() . "\n");
|
$log->logDebug(" Failed sending notifications: " . $notification->getCronError());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,23 +53,23 @@ $log->logDebug(" Reset IDLE Worker Notifications ...");
|
|||||||
// We notified, lets check which recovered
|
// We notified, lets check which recovered
|
||||||
$aNotifications = $notification->getAllActive('idle_worker');
|
$aNotifications = $notification->getAllActive('idle_worker');
|
||||||
if (!empty($aNotifications)) {
|
if (!empty($aNotifications)) {
|
||||||
$log->logInfo(" found " . count($aNotifications) . " active notification(s)\n");
|
$log->logInfo(" found " . count($aNotifications) . " active notification(s)");
|
||||||
foreach ($aNotifications as $aNotification) {
|
foreach ($aNotifications as $aNotification) {
|
||||||
$aData = json_decode($aNotification['data'], true);
|
$aData = json_decode($aNotification['data'], true);
|
||||||
$aWorker = $worker->getWorker($aData['id']);
|
$aWorker = $worker->getWorker($aData['id']);
|
||||||
$log->logDebug(" " . $aWorker['username'] . " ...");
|
$log->logDebug(" " . $aWorker['username'] . " ...");
|
||||||
if ($aWorker['hashrate'] > 0) {
|
if ($aWorker['hashrate'] > 0) {
|
||||||
if ($notification->setInactive($aNotification['id'])) {
|
if ($notification->setInactive($aNotification['id'])) {
|
||||||
$log->logDebug(" updated #" . $aNotification['id'] . " for " . $aWorker['username'] . " as inactive\n");
|
$log->logDebug(" updated #" . $aNotification['id'] . " for " . $aWorker['username'] . " as inactive");
|
||||||
} else {
|
} else {
|
||||||
$log->logError(" failed to update #" . $aNotification['id'] . " for " . $aWorker['username'] . "\n");
|
$log->logError(" failed to update #" . $aNotification['id'] . " for " . $aWorker['username']);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$log->logDebug(" still inactive\n");
|
$log->logDebug(" still inactive");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$log->logDebug(" no active IDLE worker notifications\n");
|
$log->logDebug(" no active IDLE worker notifications");
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once('cron_end.inc.php');
|
require_once('cron_end.inc.php');
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user