diff --git a/app/Jobs/Util/Import.php b/app/Jobs/Util/Import.php index 305dcfb67220..c83d8c214b40 100644 --- a/app/Jobs/Util/Import.php +++ b/app/Jobs/Util/Import.php @@ -819,7 +819,7 @@ class Import implements ShouldQueue if (isset($modified['invoices'])) { foreach ($modified['invoices'] as $key => $invoice) { - if($modified['amount'] >= 0) + if($this->tryTransformingId('invoices', $invoice['invoice_id'])) $modified['invoices'][$key]['invoice_id'] = $this->transformId('invoices', $invoice['invoice_id']); else{ $modified['credits'][$key]['credit_id'] = $this->transformId('credits', $invoice['invoice_id']); @@ -1289,6 +1289,7 @@ class Import implements ShouldQueue public function transformId($resource, string $old): int { if (! array_key_exists($resource, $this->ids)) { + info(print_r($resource,1)); throw new Exception("Resource {$resource} not available."); } @@ -1299,6 +1300,19 @@ class Import implements ShouldQueue return $this->ids[$resource]["{$resource}_{$old}"]['new']; } + private function tryTransformingId($resource, string $old): ?int + { + if (! array_key_exists($resource, $this->ids)) { + return false; + } + + if (! array_key_exists("{$resource}_{$old}", $this->ids[$resource])) { + return false; + } + + return $this->ids[$resource]["{$resource}_{$old}"]['new']; + } + /** * Process & handle user_id. * diff --git a/app/Jobs/Util/StartMigration.php b/app/Jobs/Util/StartMigration.php index f5500149c5f4..e782549ae958 100644 --- a/app/Jobs/Util/StartMigration.php +++ b/app/Jobs/Util/StartMigration.php @@ -57,7 +57,7 @@ class StartMigration implements ShouldQueue // public $maxExceptions = 2; - public $backoff = 86430; + //public $backoff = 86430; public function __construct($filepath, User $user, Company $company) { diff --git a/config/queue.php b/config/queue.php index c7961a8a9b46..6fb44cc4f7a1 100644 --- a/config/queue.php +++ b/config/queue.php @@ -38,14 +38,14 @@ return [ 'driver' => 'database', 'table' => 'jobs', 'queue' => 'default', - 'retry_after' => 900000, + 'retry_after' => 90000000, ], 'beanstalkd' => [ 'driver' => 'beanstalkd', 'host' => 'localhost', 'queue' => 'default', - 'retry_after' => 900000, + 'retry_after' => 90000000, 'block_for' => 0, ], @@ -63,7 +63,7 @@ return [ 'driver' => 'redis', 'connection' => 'default', 'queue' => env('REDIS_QUEUE', 'default'), - 'retry_after' => 900000, + 'retry_after' => 90000000, 'block_for' => null, ],