backend: allow more cpu threads to do the backup compression

if xz take too much time, mysql buffer can suffer and can overflow

Also, drop useless invalid shares after 24h, no more used in graphes
This commit is contained in:
Tanguy Pruvot 2017-07-15 16:07:21 +02:00
parent 7f28b3d8f5
commit 446cb0187c

View file

@ -6,7 +6,7 @@ function BackendDoBackup()
$filename = "/root/backup/yaamp-$d.sql";
if (is_readable("/usr/bin/xz")) {
$ziptool = "xz"; $filename .= ".xz";
$ziptool = "xz --threads=4"; $filename .= ".xz";
} else {
$ziptool = "gzip"; $filename .= ".gz";
}
@ -42,6 +42,8 @@ function BackendQuickClean()
dborun("delete from earnings where blockid in (select id from blocks where category='orphan')");
dborun("delete from earnings where blockid not in (select id from blocks)");
dborun("UPDATE blocks SET amount=0 WHERE category='orphan' AND amount>0");
$delay = time() - 24*60*60; // drop invalid shares not used anymore (24h graph only)
dborun("DELETE FROM shares WHERE valid = 0 AND time < $delay");
}
function marketHistoryPrune($symbol="")