Fix connect exception, add some debug logs.

This commit is contained in:
James Cole
2024-05-06 06:33:12 +02:00
parent 5bf4df9ad8
commit d17da670ab
3 changed files with 6 additions and 1 deletions

View File

@@ -30,6 +30,7 @@ use FireflyIII\Repositories\UserGroups\Account\AccountRepositoryInterface;
use FireflyIII\Transformers\V2\AccountTransformer; use FireflyIII\Transformers\V2\AccountTransformer;
use Illuminate\Http\JsonResponse; use Illuminate\Http\JsonResponse;
use Illuminate\Pagination\LengthAwarePaginator; use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Support\Facades\Log;
class IndexController extends Controller 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. // order is calculated in the account transformer and by that time it's too late.
$first = array_key_first($sorting); $first = array_key_first($sorting);
$disablePagination = in_array($first, ['last_activity', 'balance', 'balance_difference'], true); $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) { if (!$disablePagination) {
$accounts = $accounts->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize); $accounts = $accounts->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize);
} }

View File

@@ -29,6 +29,7 @@ use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use FireflyIII\Repositories\User\UserRepositoryInterface; use FireflyIII\Repositories\User\UserRepositoryInterface;
use GuzzleHttp\Client; use GuzzleHttp\Client;
use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Exception\RequestException;
use Illuminate\Bus\Queueable; use Illuminate\Bus\Queueable;
@@ -100,7 +101,7 @@ class DownloadExchangeRates implements ShouldQueue
try { try {
$res = $client->get($url); $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())); app('log')->warning(sprintf('Trying to grab "%s" resulted in error "%d".', $url, $e->getMessage()));
return; return;

View File

@@ -63,6 +63,8 @@ class AccountTransformer extends AbstractTransformer
$this->convertedBalances = []; $this->convertedBalances = [];
$this->balanceDifferences = []; $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. // first collect all the "heavy" stuff that relies on ALL data to be present.
// get last activity: // get last activity:
$this->getLastActivity($objects); $this->getLastActivity($objects);