mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-04 00:17:34 -05:00 
			
		
		
		
	Implement throttling on Gateway Import Customer Router
This commit is contained in:
		
							parent
							
								
									d353bfc52a
								
							
						
					
					
						commit
						d72c6508de
					
				@ -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);
 | 
				
			||||||
 | 
				
			|||||||
@ -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;
 | 
				
			||||||
 | 
				
			|||||||
@ -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();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user