1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-20 16:31:33 +02:00

Fixes for job middleware

This commit is contained in:
David Bomba 2023-02-09 12:10:08 +11:00
parent 3c72418244
commit 0479b1abbd
2 changed files with 10 additions and 13 deletions

View File

@ -106,6 +106,7 @@ class Import implements ShouldQueue
use CleanLineItems;
use Uploadable;
use SavesDocuments;
/**
* @var array
*/
@ -188,10 +189,10 @@ class Import implements ShouldQueue
$this->resources = $resources;
}
// public function middleware()
// {
// return [new WithoutOverlapping("only_one_migration_at_a_time_ever")];
// }
public function middleware()
{
return [(new WithoutOverlapping($this->user->account_id))];
}
/**
* Execute the job.
@ -1897,6 +1898,8 @@ class Import implements ShouldQueue
{
info('the job failed');
config(['queue.failed.driver' => null]);
$job_failure = new MigrationFailure();
$job_failure->string_metric5 = get_class($this);
$job_failure->string_metric6 = $exception->getMessage();
@ -1951,7 +1954,6 @@ class Import implements ShouldQueue
}
/* In V4 we use negative invoices (credits) and add then into the client balance. In V5, these sit off ledger and are applied later.
This next section will check for credit balances and reduce the client balance so that the V5 balances are correct
*/

View File

@ -52,14 +52,9 @@ class BankMatchingService implements ShouldQueue
}
/**
* The unique ID of the job.
*
* @return string
*/
public function uniqueId()
{
return (string)$this->company_id;
public function middleware()
{
return [(new WithoutOverlapping($this->company_id))];
}
}