Even more debug

This commit is contained in:
James Cole 2023-12-29 08:30:50 +01:00
parent c16f7d214f
commit 7aa3aef508
No known key found for this signature in database
GPG Key ID: B49A324B7EAD6D80

View File

@ -54,7 +54,7 @@ class ExchangeRateConverter
{ {
$start->startOfDay(); $start->startOfDay();
$end->endOfDay(); $end->endOfDay();
Log::debug(sprintf('Preparing for %s to %s between %s and %s', $from->code, $to->code, $start->format('Y-m-d'), $end->format('Y-m-d'))); Log::info(sprintf('Preparing for %s to %s between %s and %s', $from->code, $to->code, $start->format('Y-m-d'), $end->format('Y-m-d')));
$set = auth()->user() $set = auth()->user()
->currencyExchangeRates() ->currencyExchangeRates()
->where('from_currency_id', $from->id) ->where('from_currency_id', $from->id)
@ -66,7 +66,7 @@ class ExchangeRateConverter
$fallback = $this->getRate($from, $to, $start); $fallback = $this->getRate($from, $to, $start);
++$this->queryCount; ++$this->queryCount;
if (0 === $set->count()) { if (0 === $set->count()) {
Log::debug('No rates found in this period.'); Log::info('No rates found in this period.');
return; return;
} }
@ -86,7 +86,7 @@ class ExchangeRateConverter
]; ];
++$count; ++$count;
} }
Log::debug(sprintf('Found %d rates in this period.', $count)); Log::info(sprintf('Found %d rates in this period.', $count));
$currentStart = clone $start; $currentStart = clone $start;
while ($currentStart->lte($end)) { while ($currentStart->lte($end)) {
$currentDate = $currentStart->format('Y-m-d'); $currentDate = $currentStart->format('Y-m-d');
@ -157,6 +157,7 @@ class ExchangeRateConverter
// perhaps the rate has been cached during this particular run // perhaps the rate has been cached during this particular run
$preparedRate = $this->prepared[$date][$from][$to] ?? null; $preparedRate = $this->prepared[$date][$from][$to] ?? null;
if (null !== $preparedRate && 0 !== bccomp('0', $preparedRate)) { if (null !== $preparedRate && 0 !== bccomp('0', $preparedRate)) {
Log::info(sprintf('Found prepared rate from #%d to #%d on %s.', $from, $to, $date));
return $preparedRate; return $preparedRate;
} }
@ -167,10 +168,11 @@ class ExchangeRateConverter
if ('' === $rate) { if ('' === $rate) {
return null; return null;
} }
Log::info(sprintf('Found cached rate from #%d to #%d on %s.', $from, $to, $date));
return $rate; return $rate;
} }
app('log')->debug(sprintf('Going to get rate #%d->#%d (%s) from DB.', $from, $to, $date)); app('log')->info(sprintf('Going to get rate #%d->#%d (%s) from DB.', $from, $to, $date));
/** @var null|CurrencyExchangeRate $result */ /** @var null|CurrencyExchangeRate $result */
$result = auth()->user() $result = auth()->user()