diff --git a/app/Helpers/Mail/GmailTransport.php b/app/Helpers/Mail/GmailTransport.php index fd79a598da69..4ea61fa3d2bc 100644 --- a/app/Helpers/Mail/GmailTransport.php +++ b/app/Helpers/Mail/GmailTransport.php @@ -73,7 +73,6 @@ class GmailTransport extends AbstractTransport /* Need to slow down */ if($e->getCode() == '429') { - sleep(rand(5,10)); nlog("429 google - retrying "); $service->users_messages->send('me', $body, []); diff --git a/app/Jobs/Mail/NinjaMailerJob.php b/app/Jobs/Mail/NinjaMailerJob.php index f7bcf5a8f326..306213cb3079 100644 --- a/app/Jobs/Mail/NinjaMailerJob.php +++ b/app/Jobs/Mail/NinjaMailerJob.php @@ -75,7 +75,7 @@ class NinjaMailerJob implements ShouldQueue public function backoff() { - return [30, 60, 180, 240]; + return [5, 10, 30, 240]; } public function handle() @@ -445,7 +445,6 @@ class NinjaMailerJob implements ShouldQueue $message->getHeaders()->addTextHeader('gmailtoken', $token); }); - sleep(rand(1,3)); } /** @@ -472,7 +471,6 @@ class NinjaMailerJob implements ShouldQueue $google->getClient()->setAccessToken(json_encode($user->oauth_user_token)); - sleep(rand(1,6)); } catch(\Exception $e) { $this->logMailError('Gmail Token Invalid', $this->company->clients()->first()); diff --git a/app/Services/Email/EmailMailer.php b/app/Services/Email/EmailMailer.php index 897c69d2a6b3..6d885db2db28 100644 --- a/app/Services/Email/EmailMailer.php +++ b/app/Services/Email/EmailMailer.php @@ -59,7 +59,7 @@ class EmailMailer implements ShouldQueue public function backoff() { - return [30, 60, 180, 240]; + return [10, 30, 60, 240]; } public function handle(): void @@ -379,7 +379,6 @@ class EmailMailer implements ShouldQueue $message->getHeaders()->addTextHeader('gmailtoken', $token); }); - sleep(rand(1,3)); } /** @@ -406,7 +405,6 @@ class EmailMailer implements ShouldQueue $google->getClient()->setAccessToken(json_encode($user->oauth_user_token)); - sleep(rand(2,4)); } catch(\Exception $e) { $this->logMailError('Gmail Token Invalid', $this->email_service->company->clients()->first()); diff --git a/tests/Feature/BaseApiTest.php b/tests/Feature/BaseApiTest.php index b624387a3963..77428b065318 100644 --- a/tests/Feature/BaseApiTest.php +++ b/tests/Feature/BaseApiTest.php @@ -433,7 +433,7 @@ class BaseApiTest extends TestCase 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->low_token, ])->get('/api/v1/companies/'.$this->company->hashed_id) - ->assertStatus(401); + ->assertStatus(403); }