[CHANGE] Adjusted purge defaults

This commit is contained in:
Sebastian Grewe 2013-12-03 16:21:59 +01:00
parent ab2326a557
commit 847c1283b6
2 changed files with 7 additions and 6 deletions

View File

@ -172,8 +172,8 @@ class Share Extends Base {
**/ **/
public function purgeArchive() { public function purgeArchive() {
// Fallbacks if unset // Fallbacks if unset
if (!isset($this->config['purge']['shares'])) $this->config['purge']['shares'] = 500000; if (!isset($this->config['purge']['shares'])) $this->config['purge']['shares'] = 25000;
if (!isset($this->config['purge']['sleep'])) $this->config['purge']['sleep'] = 5; if (!isset($this->config['purge']['sleep'])) $this->config['purge']['sleep'] = 1;
if ($this->config['payout_system'] == 'pplns') { if ($this->config['payout_system'] == 'pplns') {
// Fetch our last block so we can go back configured rounds // Fetch our last block so we can go back configured rounds
@ -246,14 +246,15 @@ class Share Extends Base {
**/ **/
public function deleteAccountedShares($current_upstream, $previous_upstream=0) { public function deleteAccountedShares($current_upstream, $previous_upstream=0) {
// Fallbacks if unset // Fallbacks if unset
if (!isset($this->config['purge']['shares'])) $this->config['purge']['shares'] = 500000; if (!isset($this->config['purge']['shares'])) $this->config['purge']['shares'] = 25000;
if (!isset($this->config['purge']['sleep'])) $this->config['purge']['sleep'] = 5; if (!isset($this->config['purge']['sleep'])) $this->config['purge']['sleep'] = 1;
$affected = 1; $affected = 1;
while ($affected > 0) { while ($affected > 0) {
// Sleep first to allow any IO to cleanup // Sleep first to allow any IO to cleanup
sleep($this->config['purge']['sleep']); sleep($this->config['purge']['sleep']);
$stmt = $this->mysqli->prepare("DELETE FROM $this->table WHERE id > ? AND id <= ? LIMIT " . $this->config['purge']['shares']); $stmt = $this->mysqli->prepare("DELETE FROM $this->table WHERE id > ? AND id <= ? LIMIT " . $this->config['purge']['shares']);
$start = microtime(true);
if ($this->checkStmt($stmt) && $stmt->bind_param('ii', $previous_upstream, $current_upstream) && $stmt->execute()) { if ($this->checkStmt($stmt) && $stmt->bind_param('ii', $previous_upstream, $current_upstream) && $stmt->execute()) {
$affected = $stmt->affected_rows; $affected = $stmt->affected_rows;
} else { } else {

View File

@ -241,8 +241,8 @@ $config['payout_system'] = 'prop';
* sleep : 5 seconds * sleep : 5 seconds
* shares : 500000 * shares : 500000
**/ **/
$config['purge']['sleep'] = 5; $config['purge']['sleep'] = 1;
$config['purge']['shares'] = 500000; $config['purge']['shares'] = 25000;
/** /**
* Archiving configuration for debugging * Archiving configuration for debugging