Add (serp ai gen)
Add (scheduler)
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Console;
|
||||
|
||||
use App\Jobs\AISerpGenArticleJob;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Console\Scheduling\Schedule;
|
||||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
||||
|
||||
@@ -12,7 +14,21 @@ class Kernel extends ConsoleKernel
|
||||
*/
|
||||
protected function schedule(Schedule $schedule): void
|
||||
{
|
||||
// $schedule->command('inspire')->hourly();
|
||||
|
||||
// AI Gen Scheduler
|
||||
|
||||
$launched_date = Carbon::parse(config('platform.global.launched_epoch'));
|
||||
$days_since_launch = now()->diffInDays($launched_date) + 1;
|
||||
|
||||
$posts_to_generate = get_exponential_posts_gen_by_day($days_since_launch);
|
||||
$mins_betwween_posts = floor((24 * 60) / $posts_to_generate);
|
||||
|
||||
$schedule->call(function () {
|
||||
AISerpGenArticleJob::dispatch()->onQueue('default')->onConnection('default');
|
||||
|
||||
})->everyMinutes($mins_betwween_posts)->when(function () use ($mins_betwween_posts) {
|
||||
return now()->minute % $mins_betwween_posts === 0;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user