-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathKernel.php
64 lines (54 loc) · 1.95 KB
/
Kernel.php
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
namespace Biigle\Console;
use Biigle\FederatedSearchInstance;
use Biigle\Jobs\GenerateFederatedSearchIndex;
use Biigle\Jobs\UpdateFederatedSearchIndex;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
* Define the application's command schedule.
*/
protected function schedule(Schedule $schedule): void
{
$schedule->command('cache:prune-stale-tags')
->hourly()
->onOneServer();
$schedule->command('queue:prune-batches')
->daily()
->onOneServer();
$schedule->command('prune-notifications')
->daily()
->onOneServer();
$schedule->call(function () {
if (FederatedSearchInstance::withLocalToken()->exists()) {
GenerateFederatedSearchIndex::dispatch();
}
})
->name('generate-federated-search-index')
// The requests to retrieve the federated search index are sent hourly at 05.
// This should not collide with this job to generate the index.
->hourlyAt(55)
->onOneServer();
$schedule->call(function () {
FederatedSearchInstance::withRemoteToken()
->eachById([UpdateFederatedSearchIndex::class, 'dispatch']);
})
->name('update-federated-search-index')
// The jobs to generate the federated search index are run hourly at 55.
// This should not collide with this job to request the index from another
// instance.
->hourlyAt(05)
->onOneServer();
// Insert scheduled tasks here.
}
/**
* Register the Closure based commands for the application.
*/
protected function commands(): void
{
$this->load(__DIR__.'/Commands');
require base_path('routes/console.php');
}
}