Add some time logs.

This commit is contained in:
James Cole
2025-08-09 20:24:15 +02:00
parent 4196ce31f0
commit 7b714d0866
2 changed files with 6 additions and 7 deletions

View File

@@ -569,8 +569,7 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac
'transactions.native_amount as pc_amount', 'transactions.native_amount as pc_amount',
'transactions.foreign_amount', 'transactions.foreign_amount',
]) ])
->toArray() ->toArray();
;
} }

View File

@@ -92,23 +92,22 @@ trait PeriodOverview
$cache->addProperty('account-show-period-entries'); $cache->addProperty('account-show-period-entries');
$cache->addProperty($account->id); $cache->addProperty($account->id);
if ($cache->has()) { if ($cache->has()) {
// return $cache->get(); return $cache->get();
} }
/** @var array $dates */ /** @var array $dates */
$dates = Navigation::blockPeriods($start, $end, $range); $dates = Navigation::blockPeriods($start, $end, $range);
$entries = []; $entries = [];
// $spent = [];
// $earned = [];
// $transferredAway = [];
// $transferredIn = [];
// run a custom query because doing this with the collector is MEGA slow. // run a custom query because doing this with the collector is MEGA slow.
Timer::start('account-period-collect');
$transactions = $this->accountRepository->periodCollection($account, $start, $end); $transactions = $this->accountRepository->periodCollection($account, $start, $end);
Timer::stop('account-period-collect');
// loop dates // loop dates
Log::debug(sprintf('Count of loops: %d', count($dates))); Log::debug(sprintf('Count of loops: %d', count($dates)));
$loops = 0; $loops = 0;
// stop after 10 loops for memory reasons. // stop after 10 loops for memory reasons.
Timer::start('account-period-loop');
foreach ($dates as $currentDate) { foreach ($dates as $currentDate) {
$title = Navigation::periodShow($currentDate['start'], $currentDate['period']); $title = Navigation::periodShow($currentDate['start'], $currentDate['period']);
[$transactions, $spent] = $this->filterTransactionsByType(TransactionTypeEnum::WITHDRAWAL, $transactions, $currentDate['start'], $currentDate['end']); [$transactions, $spent] = $this->filterTransactionsByType(TransactionTypeEnum::WITHDRAWAL, $transactions, $currentDate['start'], $currentDate['end']);
@@ -127,6 +126,7 @@ trait PeriodOverview
]; ];
++$loops; ++$loops;
} }
Timer::stop('account-period-loop');
$cache->store($entries); $cache->store($entries);
Timer::stop('account-period-total'); Timer::stop('account-period-total');
Log::debug('End of getAccountPeriodOverview()'); Log::debug('End of getAccountPeriodOverview()');