Initial baseline: LaraBlog core with plugin commerce surface.
Captures the current working tree after theme slots, ArticleAccess, and the payment / paid-content plugins so subsequent work has a reviewable git history.
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Workerman\Timer;
|
||||
use Workerman\Worker;
|
||||
|
||||
/**
|
||||
* Long-lived Workerman process for AI queues (content optimize + comment moderation).
|
||||
*/
|
||||
class WorkermanAiCommand extends Command
|
||||
{
|
||||
protected $signature = 'workerman:ai {--count=1 : Worker processes}';
|
||||
|
||||
protected $description = 'Start Workerman workers that process ai-content and ai-moderation queues';
|
||||
|
||||
public function handle(): int
|
||||
{
|
||||
$this->info('Starting Workerman AI runtime (queues: ai-content, ai-moderation)...');
|
||||
|
||||
Worker::$pidFile = storage_path('logs/workerman-ai.pid');
|
||||
Worker::$logFile = storage_path('logs/workerman-ai.log');
|
||||
|
||||
$worker = new Worker();
|
||||
$worker->count = max(1, (int) $this->option('count'));
|
||||
$worker->name = 'larablog-ai';
|
||||
|
||||
$worker->onWorkerStart = function () {
|
||||
Timer::add(1, function () {
|
||||
Artisan::call('queue:work', [
|
||||
'--queue' => 'ai-content,ai-moderation',
|
||||
'--stop-when-empty' => true,
|
||||
'--max-time' => 50,
|
||||
'--sleep' => 1,
|
||||
'--tries' => 3,
|
||||
]);
|
||||
});
|
||||
};
|
||||
|
||||
Worker::runAll();
|
||||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user