fix(schedule): run stale multiplex cleanup on crons queue
Dispatch CleanupStaleMultiplexedConnections through the crons queue and cover the scheduled job queue assignment with a feature test.
This commit is contained in:
parent
ebf23f4874
commit
ed3780b2a7
2 changed files with 22 additions and 1 deletions
|
|
@ -41,7 +41,9 @@ protected function schedule(Schedule $schedule): void
|
|||
$this->instanceTimezone = config('app.timezone');
|
||||
}
|
||||
|
||||
$this->scheduleInstance->job(new CleanupStaleMultiplexedConnections)->hourly()->onOneServer();
|
||||
$this->scheduleInstance->job(new CleanupStaleMultiplexedConnections, crons_queue())
|
||||
->hourly()
|
||||
->onOneServer();
|
||||
$this->scheduleInstance->command('cleanup:redis --clear-locks')->daily();
|
||||
$this->scheduleInstance->command('sanctum:prune-expired --hours=1')->hourly()->onOneServer();
|
||||
$this->scheduleInstance->job(new ApiTokenExpirationWarningJob)->hourly()->onOneServer();
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
<?php
|
||||
|
||||
use App\Jobs\CleanupStaleMultiplexedConnections;
|
||||
use App\Models\InstanceSettings;
|
||||
use Illuminate\Console\Scheduling\Schedule;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\Queue;
|
||||
|
||||
uses(RefreshDatabase::class);
|
||||
|
||||
|
|
@ -21,6 +23,23 @@
|
|||
expect($event->onOneServer)->toBeTrue();
|
||||
});
|
||||
|
||||
it('schedules CleanupStaleMultiplexedConnections on the crons queue', function () {
|
||||
config(['constants.coolify.self_hosted' => false]);
|
||||
Queue::fake();
|
||||
|
||||
$schedule = app(Schedule::class);
|
||||
|
||||
$event = collect($schedule->events())->first(
|
||||
fn ($e) => str_contains((string) $e->description, CleanupStaleMultiplexedConnections::class)
|
||||
);
|
||||
|
||||
expect($event)->not->toBeNull();
|
||||
|
||||
$event->run(app());
|
||||
|
||||
Queue::assertPushedOn('crons', CleanupStaleMultiplexedConnections::class);
|
||||
});
|
||||
|
||||
it('schedules every production job with onOneServer', function () {
|
||||
$schedule = app(Schedule::class);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue