mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-03 23:37:33 -05:00 
			
		
		
		
	Merge pull request #8224 from turbo124/v5-develop
Fixes for ninja mailer
This commit is contained in:
		
						commit
						e210d9f1bb
					
				@ -206,11 +206,11 @@ class NinjaMailerJob implements ShouldQueue
 | 
				
			|||||||
                    app('sentry')->captureException($e);
 | 
					                    app('sentry')->captureException($e);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
    
 | 
					        
 | 
				
			||||||
        }
 | 
					            /* Releasing immediately does not add in the backoff */
 | 
				
			||||||
 | 
					            $this->release($this->backoff()[$this->attempts()-1]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /* Releasing immediately does not add in the backoff */
 | 
					        }
 | 
				
			||||||
        $this->release($this->backoff()[$this->attempts()-1]);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /*Clean up mailers*/ 
 | 
					        /*Clean up mailers*/ 
 | 
				
			||||||
        $this->cleanUpMailers();
 | 
					        $this->cleanUpMailers();
 | 
				
			||||||
@ -649,7 +649,8 @@ class NinjaMailerJob implements ShouldQueue
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    public function failed($exception = null)
 | 
					    public function failed($exception = null)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        
 | 
					        if($exception)
 | 
				
			||||||
 | 
					            nlog($exception->getMessage());
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -74,12 +74,16 @@ class WebhookSingle implements ShouldQueue
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    public function handle()
 | 
					    public function handle()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
nlog($this->attempts());
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        MultiDB::setDb($this->db);
 | 
					        MultiDB::setDb($this->db);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $subscription = Webhook::with('company')->find($this->subscription_id);
 | 
					        $subscription = Webhook::with('company')->find($this->subscription_id);
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
 | 
					        if(!$subscription){
 | 
				
			||||||
 | 
					            $this->fail();
 | 
				
			||||||
 | 
					            return;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $this->company = $subscription->company;
 | 
					        $this->company = $subscription->company;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $this->entity->refresh();
 | 
					        $this->entity->refresh();
 | 
				
			||||||
@ -108,15 +112,11 @@ nlog($this->attempts());
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        $client = new Client(['headers' => array_merge($base_headers, $headers)]);
 | 
					        $client = new Client(['headers' => array_merge($base_headers, $headers)]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
nlog("attempting ". $subscription->target_url);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
            $response = $client->post($subscription->target_url, [
 | 
					            $response = $client->post($subscription->target_url, [
 | 
				
			||||||
                RequestOptions::JSON => $data, // or 'json' => [...]
 | 
					                RequestOptions::JSON => $data, // or 'json' => [...]
 | 
				
			||||||
            ]);
 | 
					            ]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
nlog($response->getStatusCode());
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            SystemLogger::dispatch(
 | 
					            SystemLogger::dispatch(
 | 
				
			||||||
                array_merge((array) $response, $data),
 | 
					                array_merge((array) $response, $data),
 | 
				
			||||||
                SystemLog::CATEGORY_WEBHOOK,
 | 
					                SystemLog::CATEGORY_WEBHOOK,
 | 
				
			||||||
 | 
				
			|||||||
@ -141,10 +141,12 @@ class EmailMailer implements ShouldQueue
 | 
				
			|||||||
            $this->release($this->backoff()[$this->attempts()-1]);
 | 
					            $this->release($this->backoff()[$this->attempts()-1]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            $message = null;
 | 
					            $message = null;
 | 
				
			||||||
            $this->cleanUpMailers();
 | 
					            
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $this->cleanUpMailers();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user