Repository navigation
Expand file tree
/
Copy pathconsole.php
More file actions
42 lines (33 loc) · 1.68 KB
/
Copy pathconsole.php
File metadata and controls
42 lines (33 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
declare(strict_types=1);
use App\Actions\DeleteStoredFiles;
use App\Jobs\EndLiveStreams;
use App\Jobs\GenerateHotHeadlineSummaries;
use App\Models\Headline;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schedule;
Schedule::command('commits:submit-scheduled')->everyMinute()->withoutOverlapping(5);
Schedule::job(new EndLiveStreams())->everyFiveMinutes();
Schedule::job(new GenerateHotHeadlineSummaries())->everyFifteenMinutes();
Schedule::command('model:prune', ['--model' => [Headline::class]])->hourly()->withoutOverlapping();
Schedule::call(function (): void {
DB::table('pending_file_deletions')->orderBy('id')->chunkById(100, function (Collection $pending): void {
foreach ($pending as $deletion) {
throw_if(! isset($deletion->id), UnexpectedValueException::class, 'Invalid pending file deletion record.');
$id = $deletion->id;
throw_if(! is_int($id) && (! is_string($id) || ! ctype_digit($id)), UnexpectedValueException::class, 'Invalid pending file deletion ID.');
resolve(DeleteStoredFiles::class)->handle((int) $id);
}
});
})->name('retry-file-deletions')->everyMinute()->withoutOverlapping(5);
Schedule::call(function (): void {
$store = 'cache.stores.'.config()->string('cache.default');
if (config()->string($store.'.driver') === 'database') {
/** @var string|null $connection */
$connection = config($store.'.connection');
DB::connection($connection)->table(config()->string($store.'.table'))
->where('expiration', '<=', now()->getTimestamp())
->delete();
}
})->name('prune-expired-cache')->hourly();