X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=app%2FConsole%2FCommands%2FReevaluateChatCommand.php;h=d87179cf665c256b1f16c285ff115a141f72452d;hb=HEAD;hp=69a8374c73d4da917075e2a1f9978daee97205dc;hpb=13ffde5b2abcf831af9c794044350737066c5933;p=alttp.git diff --git a/app/Console/Commands/ReevaluateChatCommand.php b/app/Console/Commands/ReevaluateChatCommand.php index 69a8374..d87179c 100644 --- a/app/Console/Commands/ReevaluateChatCommand.php +++ b/app/Console/Commands/ReevaluateChatCommand.php @@ -5,7 +5,7 @@ namespace App\Console\Commands; use App\Models\ChatLog; use Illuminate\Console\Command; -class EvaluateChatCommand extends Command { +class ReevaluateChatCommand extends Command { /** * The name and signature of the console command. @@ -29,15 +29,17 @@ class EvaluateChatCommand extends Command { public function handle() { $good = 0; $bad = 0; - ChatLog::where('type', '=', 'chat') + ChatLog::whereIn('type', ['chat', 'error']) ->where('banned', false) ->orderBy('created_at') - ->chunk(10000, function ($logs) use (&$good, &$bad) { + ->chunk(5000, function ($logs) use (&$good, &$bad) { foreach ($logs as $line) { try { $line->evaluate(); - $line->evaluated_at = now(); - $line->save(); + if ($line->isDirty()) { + $line->evaluated_at = now(); + $line->save(); + } ++$good; } catch (\Exception $e) { ++$bad;