mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Improves for interacting with gmail API
This commit is contained in:
parent
56186840f2
commit
ac0efe9ead
@ -76,8 +76,25 @@ class GmailTransport extends Transport
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Google is very strict with their
|
||||||
|
* sending limits, if we hit 429s, sleep and
|
||||||
|
* retry again later.
|
||||||
|
*/
|
||||||
|
try{
|
||||||
|
|
||||||
$this->gmail->send();
|
$this->gmail->send();
|
||||||
|
|
||||||
|
}
|
||||||
|
catch(\Google\Service\Exception $e)
|
||||||
|
{
|
||||||
|
nlog("gmail exception");
|
||||||
|
nlog($e->getErrors());
|
||||||
|
|
||||||
|
sleep(5);
|
||||||
|
$this->gmail->send();
|
||||||
|
}
|
||||||
|
|
||||||
$this->sendPerformed($message);
|
$this->sendPerformed($message);
|
||||||
|
|
||||||
return $this->numberOfRecipients($message);
|
return $this->numberOfRecipients($message);
|
||||||
|
@ -219,7 +219,7 @@ class NinjaMailerJob implements ShouldQueue
|
|||||||
$google->getClient()->setAccessToken(json_encode($user->oauth_user_token));
|
$google->getClient()->setAccessToken(json_encode($user->oauth_user_token));
|
||||||
|
|
||||||
//need to slow down gmail requests otherwise we hit 429's
|
//need to slow down gmail requests otherwise we hit 429's
|
||||||
sleep(rand(1,3));
|
sleep(rand(2,6));
|
||||||
}
|
}
|
||||||
catch(\Exception $e) {
|
catch(\Exception $e) {
|
||||||
$this->logMailError('Gmail Token Invalid', $this->company->clients()->first());
|
$this->logMailError('Gmail Token Invalid', $this->company->clients()->first());
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
|
|
||||||
Route::group(['middleware' => ['throttle:10,1', 'api_secret_check']], function () {
|
Route::group(['middleware' => ['throttle:300,1', 'api_secret_check']], function () {
|
||||||
Route::post('api/v1/signup', 'AccountController@store')->name('signup.submit');
|
Route::post('api/v1/signup', 'AccountController@store')->name('signup.submit');
|
||||||
Route::post('api/v1/oauth_login', 'Auth\LoginController@oauthApiLogin');
|
Route::post('api/v1/oauth_login', 'Auth\LoginController@oauthApiLogin');
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user