Add (initial): futurewalker code
This commit is contained in:
@@ -2,11 +2,13 @@
|
||||
|
||||
namespace App\Console;
|
||||
|
||||
use App\Jobs\AISerpGenArticleJob;
|
||||
use Carbon\Carbon;
|
||||
use App\Jobs\BrowseAndWriteWithAIJob;
|
||||
use App\Jobs\PublishIndexPostJob;
|
||||
use Illuminate\Console\Scheduling\Schedule;
|
||||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
||||
|
||||
use App\Models\Post;
|
||||
|
||||
class Kernel extends ConsoleKernel
|
||||
{
|
||||
/**
|
||||
@@ -15,20 +17,17 @@ class Kernel extends ConsoleKernel
|
||||
protected function schedule(Schedule $schedule): void
|
||||
{
|
||||
|
||||
// AI Gen Scheduler
|
||||
$schedule->call(function () {
|
||||
BrowseAndWriteWithAIJob::dispatch()->onQueue('default')->onConnection('default');
|
||||
})->dailyAt('00:00');
|
||||
|
||||
// $launched_date = Carbon::parse(intval(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_between_posts = floor((24 * 60) / $posts_to_generate);
|
||||
$schedule->call(function () {
|
||||
$future_post = Post::whereNotNull('published_at')->where('status','future')->where('published_at', '>=', now())->orderBy('published_at','ASC')->first();
|
||||
|
||||
// $schedule->call(function () {
|
||||
// AISerpGenArticleJob::dispatch()->onQueue('default')->onConnection('default');
|
||||
// })->everyMinute()->when(function () use ($mins_between_posts, $launched_date) {
|
||||
// $minutes_since_launch = now()->diffInMinutes($launched_date);
|
||||
PublishIndexPostJob::dispatch($future_post->id)->onQueue('default')->onConnection('default');
|
||||
|
||||
// return $minutes_since_launch % $mins_between_posts === 0;
|
||||
// });
|
||||
|
||||
})->everyMinute();
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user