diff --git a/app/Console/Commands/Grapper/Sofascore/Helper/Sleeper.php b/app/Console/Commands/Grapper/Sofascore/Helper/Sleeper.php index 6c0a0778..1a7f2df1 100644 --- a/app/Console/Commands/Grapper/Sofascore/Helper/Sleeper.php +++ b/app/Console/Commands/Grapper/Sofascore/Helper/Sleeper.php @@ -4,13 +4,24 @@ namespace App\Console\Commands\Grapper\Sofascore\Helper; class Sleeper { - public static function rand($langsam = false) + public static function rand($speed = false) { - if ($langsam) { - $sleep = rand(5000000, 10000000); - } else { - $sleep = rand(100000, 150000); + switch ($speed) { + case 1: + // 5 -10 sec + $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); } } diff --git a/app/Console/Commands/Grapper/Sofascore/Rose.php b/app/Console/Commands/Grapper/Sofascore/Rose.php index f4e1d18d..263f18a3 100644 --- a/app/Console/Commands/Grapper/Sofascore/Rose.php +++ b/app/Console/Commands/Grapper/Sofascore/Rose.php @@ -67,10 +67,7 @@ class Rose SofaScoreRosa::where('id', $value->id)->update(['grapped' => 1]); - if (rand(0, 1)) - Sleeper::rand(1); - else - Sleeper::rand(0); + Sleeper::rand(rand(0, 3)); } } } diff --git a/app/Models/StatisticFixtures.php b/app/Models/StatisticFixtures.php index a1a52b88..fcc8993d 100644 --- a/app/Models/StatisticFixtures.php +++ b/app/Models/StatisticFixtures.php @@ -31,7 +31,7 @@ class StatisticFixtures extends Model */ public function prunable() { - return static::where('starttime', '<', Carbon::now('Europe/Vienna')->subMinutes(15)); + return static::where('starttime', '<', Carbon::now('Europe/Vienna')->subMinutes(5)); }