mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-30 21:24:32 -04:00
Change default queue to database
This commit is contained in:
parent
6eaf78a1d5
commit
e55de0fb1b
@ -162,9 +162,18 @@ class CreateEntityPdf implements ShouldQueue
|
|||||||
//todo - move this to the client creation stage so we don't keep hitting this unnecessarily
|
//todo - move this to the client creation stage so we don't keep hitting this unnecessarily
|
||||||
Storage::makeDirectory($path, 0775);
|
Storage::makeDirectory($path, 0775);
|
||||||
|
|
||||||
$pdf = $this->makePdf(null, null, $maker->getCompiledHTML(true));
|
$pdf = null;
|
||||||
|
|
||||||
$instance = Storage::disk($this->disk)->put($file_path, $pdf);
|
try {
|
||||||
|
|
||||||
|
$pdf = $this->makePdf(null, null, $maker->getCompiledHTML(true));
|
||||||
|
}
|
||||||
|
catch(\Exception $e) {
|
||||||
|
info(print_r($e->getMessage(),1));
|
||||||
|
}
|
||||||
|
|
||||||
|
if($pdf)
|
||||||
|
$instance = Storage::disk($this->disk)->put($file_path, $pdf);
|
||||||
|
|
||||||
return $file_path;
|
return $file_path;
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,12 @@ class BaseMailerJob implements ShouldQueue
|
|||||||
{
|
{
|
||||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||||
|
|
||||||
|
public $tries = 5; //number of retries
|
||||||
|
|
||||||
|
public $backoff = 5; //seconds to wait until retry
|
||||||
|
|
||||||
|
public $deleteWhenMissingModels = true;
|
||||||
|
|
||||||
public function setMailDriver()
|
public function setMailDriver()
|
||||||
{
|
{
|
||||||
App::forgetInstance('translator');
|
App::forgetInstance('translator');
|
||||||
|
@ -32,6 +32,14 @@ class WebhookHandler implements ShouldQueue
|
|||||||
private $event_id;
|
private $event_id;
|
||||||
|
|
||||||
private $company;
|
private $company;
|
||||||
|
|
||||||
|
public $tries = 5; //number of retries
|
||||||
|
|
||||||
|
public $backoff = 5; //seconds to wait until retry
|
||||||
|
|
||||||
|
public $deleteWhenMissingModels = true;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new job instance.
|
* Create a new job instance.
|
||||||
*
|
*
|
||||||
@ -50,28 +58,26 @@ class WebhookHandler implements ShouldQueue
|
|||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function handle() :bool
|
public function handle()
|
||||||
{//todo set multidb here
|
{//todo set multidb here
|
||||||
|
|
||||||
MultiDB::setDb($this->company->db);
|
MultiDB::setDb($this->company->db);
|
||||||
|
|
||||||
if (! $this->company || $this->company->is_disabled) {
|
if (! $this->company || $this->company->is_disabled)
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
|
|
||||||
$subscriptions = Webhook::where('company_id', $this->company->id)
|
$subscriptions = Webhook::where('company_id', $this->company->id)
|
||||||
->where('event_id', $this->event_id)
|
->where('event_id', $this->event_id)
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
if (! $subscriptions || $subscriptions->count() == 0) {
|
if (! $subscriptions || $subscriptions->count() == 0)
|
||||||
return true;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
$subscriptions->each(function ($subscription) {
|
$subscriptions->each(function ($subscription) {
|
||||||
$this->process($subscription);
|
$this->process($subscription);
|
||||||
});
|
});
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function process($subscription)
|
private function process($subscription)
|
||||||
|
@ -46,8 +46,6 @@ class InvoicePaidActivity implements ShouldQueue
|
|||||||
{
|
{
|
||||||
MultiDB::setDb($event->company->db);
|
MultiDB::setDb($event->company->db);
|
||||||
|
|
||||||
$event->invoice->service()->touchPdf();
|
|
||||||
|
|
||||||
$fields = new stdClass;
|
$fields = new stdClass;
|
||||||
|
|
||||||
$fields->invoice_id = $event->invoice->id;
|
$fields->invoice_id = $event->invoice->id;
|
||||||
@ -56,5 +54,12 @@ class InvoicePaidActivity implements ShouldQueue
|
|||||||
$fields->activity_type_id = Activity::PAID_INVOICE;
|
$fields->activity_type_id = Activity::PAID_INVOICE;
|
||||||
|
|
||||||
$this->activity_repo->save($fields, $event->invoice, $event->event_vars);
|
$this->activity_repo->save($fields, $event->invoice, $event->event_vars);
|
||||||
|
|
||||||
|
try {
|
||||||
|
$event->invoice->service()->touchPdf();
|
||||||
|
}
|
||||||
|
catch(\Exception $e){
|
||||||
|
info(print_r($e->getMessage(),1));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ return [
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'default' => env('QUEUE_CONNECTION', 'sync'),
|
'default' => env('QUEUE_CONNECTION', 'database'),
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
Loading…
x
Reference in New Issue
Block a user