diff --git a/app/Jobs/Mail/NinjaMailerJob.php b/app/Jobs/Mail/NinjaMailerJob.php index ceb8d107e0dc..f7bcf5a8f326 100644 --- a/app/Jobs/Mail/NinjaMailerJob.php +++ b/app/Jobs/Mail/NinjaMailerJob.php @@ -206,11 +206,11 @@ class NinjaMailerJob implements ShouldQueue app('sentry')->captureException($e); } - - } + + /* Releasing immediately does not add in the backoff */ + $this->release($this->backoff()[$this->attempts()-1]); - /* Releasing immediately does not add in the backoff */ - $this->release($this->backoff()[$this->attempts()-1]); + } /*Clean up mailers*/ $this->cleanUpMailers(); @@ -649,7 +649,8 @@ class NinjaMailerJob implements ShouldQueue public function failed($exception = null) { - + if($exception) + nlog($exception->getMessage()); } } \ No newline at end of file diff --git a/app/Jobs/Util/WebhookSingle.php b/app/Jobs/Util/WebhookSingle.php index d05f703e04cb..2e80af61ea4b 100644 --- a/app/Jobs/Util/WebhookSingle.php +++ b/app/Jobs/Util/WebhookSingle.php @@ -74,12 +74,16 @@ class WebhookSingle implements ShouldQueue */ public function handle() { -nlog($this->attempts()); MultiDB::setDb($this->db); $subscription = Webhook::with('company')->find($this->subscription_id); + if(!$subscription){ + $this->fail(); + return; + } + $this->company = $subscription->company; $this->entity->refresh(); @@ -108,15 +112,11 @@ nlog($this->attempts()); $client = new Client(['headers' => array_merge($base_headers, $headers)]); -nlog("attempting ". $subscription->target_url); - try { $response = $client->post($subscription->target_url, [ RequestOptions::JSON => $data, // or 'json' => [...] ]); -nlog($response->getStatusCode()); - SystemLogger::dispatch( array_merge((array) $response, $data), SystemLog::CATEGORY_WEBHOOK, diff --git a/app/Services/Email/EmailMailer.php b/app/Services/Email/EmailMailer.php index 4c8efee5098a..897c69d2a6b3 100644 --- a/app/Services/Email/EmailMailer.php +++ b/app/Services/Email/EmailMailer.php @@ -141,10 +141,12 @@ class EmailMailer implements ShouldQueue $this->release($this->backoff()[$this->attempts()-1]); $message = null; - $this->cleanUpMailers(); + } + $this->cleanUpMailers(); + } /**