added queue to horizon schedule in the kernel for console commands and scheduler

This commit is contained in:
2021-05-19 00:46:22 +09:00
parent c089beae10
commit e949b1d717
5 changed files with 37 additions and 29 deletions

View File

@@ -39,7 +39,7 @@ class ExecuteFetchAllianceAssetsCommand extends Command
*/
public function handle()
{
FAA::dispatch()->onQueue('structures');
FAA::dispatch()->onQueue('assets');
return 0;
}

View File

@@ -60,70 +60,71 @@ class Kernel extends ConsoleKernel
* Purge Data Schedule
*/
$schedule->job(new PurgeUsersJob)
->onQueue('default')
->weekly();
/**
* Finances Update Schedule
*/
$schedule->job(new UpdateAllianceWalletJournalJob)
->timezone('UTC')
->hourlyAt('45')
->onQueue('finances')
->withoutOverlapping();
/**
* Item Update Schedule
*/
$schedule->job(new UpdateItemPricesJob)
->timezone('UTC')
->hourlyAT('30')
->onQueue('default');
->withoutOverlapping();
/**
* Mining Tax Schedule
*/
$schedule->job(new FetchMiningTaxesObservers)
->timezone('UTC')
->dailyAt('22:00')
->onQueue('miningtaxes')
->withoutOverlapping();
$schedule->job(new PreFetchMiningTaxesLedgers)
->timezone('UTC')
->dailyAt('20:00')
->onQueue('miningtaxes')
->withoutOverlapping();
$schedule->job(new SendMiningTaxesInvoices)
->timezone('UTC')
->weeklyOn(1, '06:00')
->onQueue('miningtaxes')
->withoutOverlapping();
$schedule->job(new ProcessMiningTaxesPayments)
->timezone('UTC')
->hourlyAt('15')
->onQueue('miningtaxes')
->withoutOverlapping();
$schedule->job(new UpdateMiningTaxesLateInvoices1st)
->timezone('UTC')
->monthlyOn(1, '16:00')
->onQueue('miningtaxes')
->withoutOverlapping();
$schedule->job(new UpdateMiningTaxesLateInvoices15th)
->timezone('UTC')
->monthlyOn(15, '16:00')
->onQueue('miningtaxes')
->withoutOverlapping();
/**
* Alliance Structure and Assets Schedule
*/
$schedule->job(new FetchAllianceStructures)
->timezone('UTC')
->dailyAt('21:00')
->onQueue('structures')
->withoutOverlapping();
$schedule->job(new FetchAllianceAssets)
->timezone('UTC')
->hourlyAt('15')
->onQueue('structures')
->withoutOverlapping();
$schedule->job(new PurgeAllianceStructures)
->timezone('UTC')
->monthlyOn(2, '14:00')
->onQueue('structures')
->withoutOverlapping();
$schedule->job(new PurgeAllianceAssets)
->timezone('UTC')
->monthlyOn(2, '15:00')
->onQueue('structures')
->withoutOverlapping();
}
@@ -139,4 +140,14 @@ class Kernel extends ConsoleKernel
require base_path('routes/console.php');
}
/**
* Get the timezone that should be used by default for scheduled events.
*
* @return \DateTimeZone|string|null
*/
protected function scheduleTimezone()
{
return 'UTC';
}
}

View File

@@ -57,7 +57,11 @@ class ProcessAllianceAssets implements ShouldQueue
* If the asset is not in the database, then let's save it to the database,
* otherwise, we just update the old asset
*/
if(Asset::where(['item_id' => $this->asset->item_id])->count() == 0) {
$count = Asset::where([
'item_id' => $this->asset->item_id,
])->count();
if($count == 0) {
$as = new Asset;
if(isset($this->asset->is_blueprint_copy)) {
$as->is_blueprint_copy = $this->asset->is_blueprint_copy;

View File

@@ -13,9 +13,6 @@ use Illuminate\Queue\SerializesModels;
use App\Library\Helpers\LookupHelper;
use App\Library\Esi\Esi;
//Jobs
use App\Jobs\Commands\Structures\ProcessAllianceStructureServices;
//Models
use App\Models\Structure\Structure;
use App\Models\Structure\Service;
@@ -98,6 +95,12 @@ class ProcessAllianceStructures implements ShouldQueue
$s->corporation_id = $structure->corporation_id;
if(isset($structure->services)) {
$s->services = true;
foreach($structure->services as $service) {
$serv = new Service;
$serv->structure_id = $structure->structure_id;
$serv->name = $service->name;
$serv->state = $service->state;
}
} else {
$s->services = false;
}
@@ -123,16 +126,6 @@ class ProcessAllianceStructures implements ShouldQueue
$s->unanchors_at = $esiHelper->DecodeDate($s->unanchors_at);
}
$s->save();
//If there are services on the structure, then save the service and the structure id in the database table.
if($s->services == true) {
foreach($structure->services as $service) {
$serv = new Service;
$serv->structure_id = $structure->structure_id;
$serv->name = $service->name;
$serv->state = $service->state;
}
}
}
private function UpdateStructure($structure) {

View File

@@ -154,7 +154,7 @@ return [
'balance' => 'auto',
'processes' => 12,
'minProcesses' => 1,
'maxProcesses' => 12,
'maxProcesses' => 10,
'balanceMaxShift' => 2,
'balanceCooldown' => 5,
'tries' => 3,
@@ -175,7 +175,7 @@ return [
'balance' => 'auto',
'processes' => 12,
'minProcesses' => 1,
'maxProcesses' => 12,
'maxProcesses' => 10,
'balanceMaxShift' => 2,
'balanceCooldown' => 5,
'tries' => 3,