updated rental moon command with the correct job calls in the right order

updated the horizon redis configuration to add new processes and a new job queue called moons for the new moon rental coding
This commit is contained in:
2020-05-10 22:22:26 -05:00
parent 08844a50f7
commit f3e3406e04
4 changed files with 79 additions and 37 deletions

View File

@@ -0,0 +1,71 @@
<?php
namespace App\Console\Commands\Moons;
//Internal Library
use Illuminate\Console\Command;
use Carbon\Carbon;
use Log;
//Jobs
use App\Jobs\ProcessSendEveMailJob;
use App\Jobs\Commands\Moons\MoonRentalInvoiceCreate;
//Library
use Commands\Library\CommandHelper;
//Models
use App\Models\Moon\MoonRental;
class RentalMoonCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'services:RentalMoons';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Rental Moons jobs';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
//Declare variables
$delay = 0;
//Create the new command helper container
$task = new CommandHelper('RentalMoonCommand');
//Add the entry saying the job has started
$task->SetStartStatus();
//Get all of the contacts from the rentals group
$contacts = MoonRental::select('Contact')->groupBy('Contact')->get();
foreach($contacts as $contact) {
MoonrentalInvoiceCreate::dispatch($contact, $delay)->onQueue('moons');
}
//Set the job as completed
$task->SetStopStatus();
}
}

View File

@@ -113,6 +113,9 @@ class MoonRentalInvoiceCreate implements ShouldQueue
$body .= "Sincerely,<br>"; $body .= "Sincerely,<br>";
$body .= "Warped Intentions Leadership<br>"; $body .= "Warped Intentions Leadership<br>";
//Create the moon invoice and save it to the database
//Dispatch a new mail job //Dispatch a new mail job
$mail = new JobSendEveMail; $mail = new JobSendEveMail;
$mail->sender = $config['primary']; $mail->sender = $config['primary'];
@@ -122,7 +125,7 @@ class MoonRentalInvoiceCreate implements ShouldQueue
$mail->recipient_type = 'character'; $mail->recipient_type = 'character';
ProcessSendEveMailJob::dispatch($mail)->onQueue('mail')->delay(Carbon::now()->addSeconds($this->delay)); ProcessSendEveMailJob::dispatch($mail)->onQueue('mail')->delay(Carbon::now()->addSeconds($this->delay));
MoonRentalUpdate::dispatch($this->rentals); MoonRentalUpdate::dispatch($this->rentals)->onQueue('moons');
} }
private function TotalizeMoonCost() { private function TotalizeMoonCost() {

View File

@@ -1,34 +0,0 @@
<?php
namespace App\Jobs\Commands\Moons;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
class MoonRentalPaymentJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
//
}
}

View File

@@ -148,9 +148,10 @@ return [
'mail', 'mail',
'structures', 'structures',
'assets', 'assets',
'moons',
], ],
'balance' => 'auto', 'balance' => 'auto',
'processes' => 10, 'processes' => 12,
'tries' => 3, 'tries' => 3,
], ],
], ],
@@ -164,9 +165,10 @@ return [
'mail', 'mail',
'structures', 'structures',
'assets', 'assets',
'moons',
], ],
'balance' => 'auto', 'balance' => 'auto',
'processes' => 10, 'processes' => 12,
'tries' => 3, 'tries' => 3,
], ],
], ],