StatisticFixtures prunable 5min from starttime
This commit is contained in:
1 parent
269210f596
commit
8848edb3c1
3 files changed
+18
-10
No files matched your search
@@ -4,13 +4,24 @@ namespace App\Console\Commands\Grapper\Sofascore\Helper;
|
|||||||
|
|
||||||
class Sleeper
|
class Sleeper
|
||||||
{
|
{
|
||||||
public static function rand($langsam = false)
|
public static function rand($speed = false)
|
||||||
{
|
{
|
||||||
if ($langsam) {
|
switch ($speed) {
|
||||||
$sleep = rand(5000000, 10000000);
|
case 1:
|
||||||
} else {
|
// 5 -10 sec
|
||||||
$sleep = rand(100000, 150000);
|
$sleep = rand(5000000, 10000000);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
// 10 - 20 sec
|
||||||
|
$sleep = rand(10000000, 20000000);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
// 1 -1.5 sec
|
||||||
|
$sleep = rand(100000, 150000);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
usleep($sleep);
|
usleep($sleep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -67,10 +67,7 @@ class Rose
|
|||||||
|
|
||||||
SofaScoreRosa::where('id', $value->id)->update(['grapped' => 1]);
|
SofaScoreRosa::where('id', $value->id)->update(['grapped' => 1]);
|
||||||
|
|
||||||
if (rand(0, 1))
|
Sleeper::rand(rand(0, 3));
|
||||||
Sleeper::rand(1);
|
|
||||||
else
|
|
||||||
Sleeper::rand(0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -31,7 +31,7 @@ class StatisticFixtures extends Model
|
|||||||
*/
|
*/
|
||||||
public function prunable()
|
public function prunable()
|
||||||
{
|
{
|
||||||
return static::where('starttime', '<', Carbon::now('Europe/Vienna')->subMinutes(15));
|
return static::where('starttime', '<', Carbon::now('Europe/Vienna')->subMinutes(5));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user