mirror of
https://github.com/LBRYFoundation/pool.git
synced 2025-09-30 15:20:36 +00:00
benchs: prevent too much records from the same user
This commit is contained in:
parent
548f31e846
commit
bf3259b73c
1 changed files with 10 additions and 1 deletions
|
@ -12,8 +12,17 @@ function BenchUpdateChips()
|
||||||
foreach ($benchs as $bench) {
|
foreach ($benchs as $bench) {
|
||||||
if (empty($bench->vendorid) || empty($bench->device)) continue;
|
if (empty($bench->vendorid) || empty($bench->device)) continue;
|
||||||
|
|
||||||
debuglog("bench: {$bench->device}...");
|
$dups = getdbocount('db_benchmarks', "vendorid=:vid AND client=:client AND os=:os AND driver=:drv AND throughput=:thr AND userid=:uid",
|
||||||
|
array(':vid'=>$bench->vendorid, ':client'=>$bench->client, ':os'=>$bench->os, ':drv'=>$bench->driver,':thr'=>$bench->throughput,':uid'=>$bench->userid)
|
||||||
|
);
|
||||||
|
if ($dups > 10) {
|
||||||
|
debuglog("bench: {$bench->device} ignored ($dups records already present)");
|
||||||
|
$bench->delete();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$chip = getChipName($bench->attributes);
|
$chip = getChipName($bench->attributes);
|
||||||
|
debuglog("bench: {$bench->device} ($chip)...");
|
||||||
if (!empty($chip) && $chip != '-') {
|
if (!empty($chip) && $chip != '-') {
|
||||||
$bench->chip = $chip;
|
$bench->chip = $chip;
|
||||||
$bench->save();
|
$bench->save();
|
||||||
|
|
Loading…
Add table
Reference in a new issue