Improve the bunq routine so it will keep looping when faced with default PHP time out settings (30 seconds).

This commit is contained in:
James Cole
2018-08-30 19:12:52 +02:00
parent 6d28ece616
commit dfa9e537b3
5 changed files with 193 additions and 47 deletions

View File

@@ -73,6 +73,33 @@ class ImportJobRepository implements ImportJobRepositoryInterface
return $job;
}
/**
* Append transactions to array instead of replacing them.
*
* @param ImportJob $job
* @param array $transactions
*
* @return ImportJob
*/
public function appendTransactions(ImportJob $job, array $transactions): ImportJob
{
Log::debug(sprintf('Now in appendTransactions(%s)', $job->key));
$existingTransactions = $job->transactions;
if (!\is_array($existingTransactions)) {
$existingTransactions = [];
}
$new = array_merge($existingTransactions, $transactions);
Log::debug(sprintf('Old transaction count: %d', \count($existingTransactions)));
Log::debug(sprintf('To be added transaction count: %d', \count($transactions)));
Log::debug(sprintf('New count: %d', \count($new)));
$job->transactions = $new;
$job->save();
return $job;
}
/**
* @param string $importProvider
*