mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-09-20 08:21:34 +02:00
Improves for interacting with gmail API
This commit is contained in:
parent
56186840f2
commit
ac0efe9ead
@ -76,7 +76,24 @@ class GmailTransport extends Transport
|
||||
|
||||
}
|
||||
|
||||
$this->gmail->send();
|
||||
/**
|
||||
* Google is very strict with their
|
||||
* sending limits, if we hit 429s, sleep and
|
||||
* retry again later.
|
||||
*/
|
||||
try{
|
||||
|
||||
$this->gmail->send();
|
||||
|
||||
}
|
||||
catch(\Google\Service\Exception $e)
|
||||
{
|
||||
nlog("gmail exception");
|
||||
nlog($e->getErrors());
|
||||
|
||||
sleep(5);
|
||||
$this->gmail->send();
|
||||
}
|
||||
|
||||
$this->sendPerformed($message);
|
||||
|
||||
|
@ -219,7 +219,7 @@ class NinjaMailerJob implements ShouldQueue
|
||||
$google->getClient()->setAccessToken(json_encode($user->oauth_user_token));
|
||||
|
||||
//need to slow down gmail requests otherwise we hit 429's
|
||||
sleep(rand(1,3));
|
||||
sleep(rand(2,6));
|
||||
}
|
||||
catch(\Exception $e) {
|
||||
$this->logMailError('Gmail Token Invalid', $this->company->clients()->first());
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
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/oauth_login', 'Auth\LoginController@oauthApiLogin');
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user