benchs: prevent too much records from the same user

This commit is contained in:
Tanguy Pruvot 2016-07-04 07:13:18 +02:00
parent 548f31e846
commit bf3259b73c

View file

@ -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();