Skip to content

Firefly III: a personal finances manager

Add some time logs.

James Cole7b714d0866b0
diff --git a/app/Repositories/Account/AccountRepository.php b/app/Repositories/Account/AccountRepository.php
index afd301bf22..31488bb66d 100644
--- a/app/Repositories/Account/AccountRepository.php
+++ b/app/Repositories/Account/AccountRepository.php
@@ -569,8 +569,7 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac
'transactions.native_amount as pc_amount',
'transactions.foreign_amount',
])
- ->toArray()
- ;
+ ->toArray();
}
diff --git a/app/Support/Http/Controllers/PeriodOverview.php b/app/Support/Http/Controllers/PeriodOverview.php
index 19c8b61814..717e0545a4 100644
--- a/app/Support/Http/Controllers/PeriodOverview.php
+++ b/app/Support/Http/Controllers/PeriodOverview.php
@@ -92,23 +92,22 @@ trait PeriodOverview
$cache->addProperty('account-show-period-entries');
$cache->addProperty($account->id);
if ($cache->has()) {
- // return $cache->get();
+ return $cache->get();
}
/** @var array $dates */
$dates = Navigation::blockPeriods($start, $end, $range);
$entries = [];
-// $spent = [];
-// $earned = [];
-// $transferredAway = [];
-// $transferredIn = [];
// 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);
+ Timer::stop('account-period-collect');
// loop dates
Log::debug(sprintf('Count of loops: %d', count($dates)));
$loops = 0;
// stop after 10 loops for memory reasons.
+ Timer::start('account-period-loop');
foreach ($dates as $currentDate) {
$title = Navigation::periodShow($currentDate['start'], $currentDate['period']);
[$transactions, $spent] = $this->filterTransactionsByType(TransactionTypeEnum::WITHDRAWAL, $transactions, $currentDate['start'], $currentDate['end']);
@@ -127,6 +126,7 @@ trait PeriodOverview
];
++$loops;
}
+ Timer::stop('account-period-loop');
$cache->store($entries);
Timer::stop('account-period-total');
Log::debug('End of getAccountPeriodOverview()');