From f3e3406e04fc9699dfe1218c05c7f848ed910f4d Mon Sep 17 00:00:00 2001 From: drkthunder02 Date: Sun, 10 May 2020 22:22:26 -0500 Subject: [PATCH] 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 --- .../Commands/Moons/RentalMoonCommand.php | 71 +++++++++++++++++++ .../Moons/MoonRentalInvoiceCreate.php | 5 +- .../Commands/Moons/MoonRentalPaymentJob.php | 34 --------- config/horizon.php | 6 +- 4 files changed, 79 insertions(+), 37 deletions(-) create mode 100644 app/Console/Commands/Moons/RentalMoonCommand.php delete mode 100644 app/Jobs/Commands/Moons/MoonRentalPaymentJob.php diff --git a/app/Console/Commands/Moons/RentalMoonCommand.php b/app/Console/Commands/Moons/RentalMoonCommand.php new file mode 100644 index 000000000..b9eb818a6 --- /dev/null +++ b/app/Console/Commands/Moons/RentalMoonCommand.php @@ -0,0 +1,71 @@ +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(); + } +} diff --git a/app/Jobs/Commands/Moons/MoonRentalInvoiceCreate.php b/app/Jobs/Commands/Moons/MoonRentalInvoiceCreate.php index de3860435..afd447e94 100644 --- a/app/Jobs/Commands/Moons/MoonRentalInvoiceCreate.php +++ b/app/Jobs/Commands/Moons/MoonRentalInvoiceCreate.php @@ -113,6 +113,9 @@ class MoonRentalInvoiceCreate implements ShouldQueue $body .= "Sincerely,
"; $body .= "Warped Intentions Leadership
"; + //Create the moon invoice and save it to the database + + //Dispatch a new mail job $mail = new JobSendEveMail; $mail->sender = $config['primary']; @@ -122,7 +125,7 @@ class MoonRentalInvoiceCreate implements ShouldQueue $mail->recipient_type = 'character'; ProcessSendEveMailJob::dispatch($mail)->onQueue('mail')->delay(Carbon::now()->addSeconds($this->delay)); - MoonRentalUpdate::dispatch($this->rentals); + MoonRentalUpdate::dispatch($this->rentals)->onQueue('moons'); } private function TotalizeMoonCost() { diff --git a/app/Jobs/Commands/Moons/MoonRentalPaymentJob.php b/app/Jobs/Commands/Moons/MoonRentalPaymentJob.php deleted file mode 100644 index 59ceff7e2..000000000 --- a/app/Jobs/Commands/Moons/MoonRentalPaymentJob.php +++ /dev/null @@ -1,34 +0,0 @@ - 'auto', - 'processes' => 10, + 'processes' => 12, 'tries' => 3, ], ], @@ -164,9 +165,10 @@ return [ 'mail', 'structures', 'assets', + 'moons', ], 'balance' => 'auto', - 'processes' => 10, + 'processes' => 12, 'tries' => 3, ], ],