From d17da670ab70e09c5b2e9a6559531cb6ce3671ec Mon Sep 17 00:00:00 2001 From: James Cole Date: Mon, 6 May 2024 06:33:12 +0200 Subject: [PATCH] Fix connect exception, add some debug logs. --- app/Api/V2/Controllers/Model/Account/IndexController.php | 2 ++ app/Jobs/DownloadExchangeRates.php | 3 ++- app/Transformers/V2/AccountTransformer.php | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/Api/V2/Controllers/Model/Account/IndexController.php b/app/Api/V2/Controllers/Model/Account/IndexController.php index f92331d685..2acab14c08 100644 --- a/app/Api/V2/Controllers/Model/Account/IndexController.php +++ b/app/Api/V2/Controllers/Model/Account/IndexController.php @@ -30,6 +30,7 @@ use FireflyIII\Repositories\UserGroups\Account\AccountRepositoryInterface; use FireflyIII\Transformers\V2\AccountTransformer; use Illuminate\Http\JsonResponse; use Illuminate\Pagination\LengthAwarePaginator; +use Illuminate\Support\Facades\Log; class IndexController extends Controller { @@ -74,6 +75,7 @@ class IndexController extends Controller // order is calculated in the account transformer and by that time it's too late. $first = array_key_first($sorting); $disablePagination = in_array($first, ['last_activity', 'balance', 'balance_difference'], true); + Log::debug(sprintf('Will disable pagination in account index v2? %s', var_export($disablePagination, true))); if (!$disablePagination) { $accounts = $accounts->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize); } diff --git a/app/Jobs/DownloadExchangeRates.php b/app/Jobs/DownloadExchangeRates.php index 70c437c54c..ca7d0bc8e9 100644 --- a/app/Jobs/DownloadExchangeRates.php +++ b/app/Jobs/DownloadExchangeRates.php @@ -29,6 +29,7 @@ use FireflyIII\Models\TransactionCurrency; use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; use FireflyIII\Repositories\User\UserRepositoryInterface; use GuzzleHttp\Client; +use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\RequestException; use Illuminate\Bus\Queueable; @@ -100,7 +101,7 @@ class DownloadExchangeRates implements ShouldQueue try { $res = $client->get($url); - } catch (RequestException $e) { + } catch (RequestException|ConnectException $e) { app('log')->warning(sprintf('Trying to grab "%s" resulted in error "%d".', $url, $e->getMessage())); return; diff --git a/app/Transformers/V2/AccountTransformer.php b/app/Transformers/V2/AccountTransformer.php index 026917f9e1..18eb6eb5fb 100644 --- a/app/Transformers/V2/AccountTransformer.php +++ b/app/Transformers/V2/AccountTransformer.php @@ -63,6 +63,8 @@ class AccountTransformer extends AbstractTransformer $this->convertedBalances = []; $this->balanceDifferences = []; + Log::debug(sprintf('collectMetaData on %d object(s)', $objects->count())); + // first collect all the "heavy" stuff that relies on ALL data to be present. // get last activity: $this->getLastActivity($objects);