Implement throttling on Gateway Import Customer Router

This commit is contained in:
David Bomba 2024-04-02 12:37:55 +11:00
parent d353bfc52a
commit d72c6508de
3 changed files with 7 additions and 3 deletions

View File

@ -565,9 +565,11 @@ class CompanyGatewayController extends BaseController
public function importCustomers(TestCompanyGatewayRequest $request, CompanyGateway $company_gateway) public function importCustomers(TestCompanyGatewayRequest $request, CompanyGateway $company_gateway)
{ {
// $x = Cache::pull("throttle_polling:import_customers:{$company_gateway->company->company_key}:{$company_gateway->hashed_id}");
//Throttle here //Throttle here
// if (Cache::get("throttle_polling:import_customers:{$company_gateway->company->company_key}:{$company_gateway->hashed_id}")) if (Cache::has("throttle_polling:import_customers:{$company_gateway->company->company_key}:{$company_gateway->hashed_id}"))
// return response()->json(['message' => ctrans('texts.import_started')], 200); return response()->json(['message' => 'Please wait whilst your previous attempts complete.'], 200);
dispatch(function () use($company_gateway) { dispatch(function () use($company_gateway) {
MultiDB::setDb($company_gateway->company->db); MultiDB::setDb($company_gateway->company->db);

View File

@ -103,7 +103,7 @@ class AuthorizeCustomer
} else { } else {
// nlog("creating client"); // nlog("creating client");
$first_payment_profile = $profile['payment_profiles'][0]; $first_payment_profile = &$profile['payment_profiles'][0];
if (! $first_payment_profile) { if (! $first_payment_profile) {
continue; continue;

View File

@ -195,6 +195,8 @@ class AuthorizePaymentDriver extends BaseDriver
{ {
$this->init(); $this->init();
nlog("starting import auth.net");
return (new AuthorizeCustomer($this))->importCustomers(); return (new AuthorizeCustomer($this))->importCustomers();
} }