[IMPROVED] Added logging failed SQL queries to payouts
This commit is contained in:
parent
e2623eb4cc
commit
172444d3d8
@ -209,15 +209,15 @@ foreach ($aAllBlocks as $iIndex => $aBlock) {
|
||||
|
||||
// Move counted shares to archive before this blockhash upstream share
|
||||
if (!$share->moveArchive($iCurrentUpstreamId, $aBlock['id'], $iPreviousShareId))
|
||||
$log->logError('Failed to copy shares to archive table');
|
||||
$log->logError('Failed to copy shares to archive table: ' . $share->getError());
|
||||
// Delete all accounted shares
|
||||
if (!$share->deleteAccountedShares($iCurrentUpstreamId, $iPreviousShareId)) {
|
||||
$log->logFatal("Failed to delete accounted shares from $iPreviousShareId to $iCurrentUpstreamId, aborting!");
|
||||
$log->logFatal("Failed to delete accounted shares from $iPreviousShareId to $iCurrentUpstreamId, aborting! Error: " . $share->getError());
|
||||
$monitoring->endCronjob($cron_name, 'E0016', 1, true);
|
||||
}
|
||||
// Mark this block as accounted for
|
||||
if (!$block->setAccounted($aBlock['id'])) {
|
||||
$log->logFatal("Failed to mark block as accounted! Aborting!");
|
||||
$log->logFatal("Failed to mark block as accounted! Aborting! Error: " . $block->getError());
|
||||
$monitoring->endCronjob($cron_name, 'E0014', 1, true);
|
||||
}
|
||||
} else {
|
||||
|
||||
@ -146,23 +146,17 @@ foreach ($aAllBlocks as $iIndex => $aBlock) {
|
||||
// Move shares to archive
|
||||
if ($aBlock['share_id'] < $iLastShareId) {
|
||||
if (!$share->moveArchive($aBlock['share_id'], $aBlock['id'], @$iLastBlockShare))
|
||||
$log->logError("Archving failed");
|
||||
$log->logError("Failed to copy shares to archive: " . $share->getError());
|
||||
}
|
||||
// Delete shares
|
||||
if ($aBlock['share_id'] < $iLastShareId && !$share->deleteAccountedShares($aBlock['share_id'], $iLastBlockShare)) {
|
||||
$log->logFatal("Failed to delete accounted shares from " . $aBlock['share_id'] . " to " . $iLastBlockShare . ", aborting!");
|
||||
$monitoring->setStatus($cron_name . "_active", "yesno", 0);
|
||||
$monitoring->setStatus($cron_name . "_message", "message", "Failed to delete accounted shares from " . $aBlock['share_id'] . " to " . $iLastBlockShare);
|
||||
$monitoring->setStatus($cron_name . "_status", "okerror", 1);
|
||||
exit(1);
|
||||
$log->logFatal("Failed to delete accounted shares from " . $aBlock['share_id'] . " to " . $iLastBlockShare . ", aborting! Error: " . $share->getError());
|
||||
$monitoring->endCronjob($cron_name, 'E0016', 1, true);
|
||||
}
|
||||
// Mark this block as accounted for
|
||||
if (!$block->setAccounted($aBlock['id'])) {
|
||||
$log->logFatal("Failed to mark block as accounted! Aborting!");
|
||||
$monitoring->setStatus($cron_name . "_active", "yesno", 0);
|
||||
$monitoring->setStatus($cron_name . "_message", "message", "Failed to mark block " . $aBlock['height'] . " as accounted");
|
||||
$monitoring->setStatus($cron_name . "_status", "okerror", 1);
|
||||
exit(1);
|
||||
$log->logFatal("Failed to mark block as accounted! Aborting! Error: " . $block->getError());
|
||||
$monitoring->endCronjob($cron_name, 'E0014', 1, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -105,15 +105,15 @@ foreach ($aAllBlocks as $iIndex => $aBlock) {
|
||||
|
||||
// Move counted shares to archive before this blockhash upstream share
|
||||
if (!$share->moveArchive($iCurrentUpstreamId, $aBlock['id'], $iPreviousShareId))
|
||||
$log->logError('Failed to copy shares to archive');
|
||||
$log->logError('Failed to copy shares to archive: ' . $share->getError());
|
||||
// Delete all accounted shares
|
||||
if (!$share->deleteAccountedShares($iCurrentUpstreamId, $iPreviousShareId)) {
|
||||
$log->logFatal('Failed to delete accounted shares from ' . $iPreviousShareId . ' to ' . $iCurrentUpstreamId . ', aborted');
|
||||
$log->logFatal('Failed to delete accounted shares from ' . $iPreviousShareId . ' to ' . $iCurrentUpstreamId . ', aborted! Error: ' . $share->getError());
|
||||
$monitoring->endCronjob($cron_name, 'E0016', 1, true);
|
||||
}
|
||||
// Mark this block as accounted for
|
||||
if (!$block->setAccounted($aBlock['id'])) {
|
||||
$log->logFatal('Failed to mark block as accounted! Aborted.');
|
||||
$log->logFatal('Failed to mark block as accounted! Aborted! Error: ' . $block->getError());
|
||||
$monitoring->endCronjob($cron_name, 'E0014', 1, true);
|
||||
}
|
||||
} else {
|
||||
|
||||
@ -228,6 +228,7 @@ class Share Extends Base {
|
||||
return true;
|
||||
}
|
||||
// Catchall
|
||||
$this->setErrorMessage('Archiving shares failed: ' . $this->mysqli->error);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -236,6 +237,7 @@ class Share Extends Base {
|
||||
if ($this->checkStmt($stmt) && $stmt->bind_param('ii', $previous_upstream, $current_upstream) && $stmt->execute())
|
||||
return true;
|
||||
// Catchall
|
||||
$this->setErrorMessage('Deleting shares failed: ' . $this->mysqli->error);
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user