From ac1072170f47eee3c26082b57b2786157968c0a1 Mon Sep 17 00:00:00 2001 From: natsoni Date: Wed, 6 Aug 2025 16:47:44 +0200 Subject: [PATCH 1/4] Update conversions rates before sending them to websocket --- backend/src/tasks/price-updater.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/src/tasks/price-updater.ts b/backend/src/tasks/price-updater.ts index 467669a6f..8fa9fc700 100644 --- a/backend/src/tasks/price-updater.ts +++ b/backend/src/tasks/price-updater.ts @@ -273,10 +273,6 @@ class PriceUpdater { this.latestPrices.time = Math.round(new Date().getTime() / 1000); logger.info(`Latest BTC fiat averaged price: ${JSON.stringify(this.latestPrices)}`); - if (this.ratesChangedCallback) { - this.ratesChangedCallback(this.latestPrices); - } - if (!forceUpdate) { this.cyclePosition++; } @@ -284,6 +280,10 @@ class PriceUpdater { if (this.latestPrices.USD === -1) { this.latestPrices = await PricesRepository.$getLatestConversionRates(); } + + if (this.ratesChangedCallback) { + this.ratesChangedCallback(this.latestPrices); + } } /** From 40f32c83d13b3994df8efc233ea9aca35fa51fc4 Mon Sep 17 00:00:00 2001 From: natsoni Date: Wed, 6 Aug 2025 16:51:39 +0200 Subject: [PATCH 2/4] Log when falling back to latest known price --- backend/src/tasks/price-updater.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/backend/src/tasks/price-updater.ts b/backend/src/tasks/price-updater.ts index 8fa9fc700..75027d07f 100644 --- a/backend/src/tasks/price-updater.ts +++ b/backend/src/tasks/price-updater.ts @@ -279,6 +279,7 @@ class PriceUpdater { if (this.latestPrices.USD === -1) { this.latestPrices = await PricesRepository.$getLatestConversionRates(); + logger.warn(`No BTC price available, falling back to latest known price: ${JSON.stringify(this.latestPrices)}`); } if (this.ratesChangedCallback) { From a20d38366475bafa35a8e3e265dd8828f19b0ed1 Mon Sep 17 00:00:00 2001 From: natsoni Date: Wed, 6 Aug 2025 17:57:52 +0200 Subject: [PATCH 3/4] Check if latest USD price is valid before updating rates --- backend/src/tasks/price-updater.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/tasks/price-updater.ts b/backend/src/tasks/price-updater.ts index 75027d07f..8fd2779cf 100644 --- a/backend/src/tasks/price-updater.ts +++ b/backend/src/tasks/price-updater.ts @@ -282,7 +282,7 @@ class PriceUpdater { logger.warn(`No BTC price available, falling back to latest known price: ${JSON.stringify(this.latestPrices)}`); } - if (this.ratesChangedCallback) { + if (this.ratesChangedCallback && this.latestPrices.USD > 0) { this.ratesChangedCallback(this.latestPrices); } } From 62dd1ca1db4b2170a4fcc713c47e579b7270d0fa Mon Sep 17 00:00:00 2001 From: nymkappa <1612910616@pm.me> Date: Thu, 7 Aug 2025 19:19:13 +0200 Subject: [PATCH 4/4] [prices] only print "latest avg price from exchanges" upon success --- backend/src/tasks/price-updater.ts | 3 ++- frontend/src/app/app-routing.module.ts | 2 -- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/backend/src/tasks/price-updater.ts b/backend/src/tasks/price-updater.ts index 8fd2779cf..2cf0fbdb4 100644 --- a/backend/src/tasks/price-updater.ts +++ b/backend/src/tasks/price-updater.ts @@ -271,7 +271,6 @@ class PriceUpdater { } this.latestPrices.time = Math.round(new Date().getTime() / 1000); - logger.info(`Latest BTC fiat averaged price: ${JSON.stringify(this.latestPrices)}`); if (!forceUpdate) { this.cyclePosition++; @@ -280,6 +279,8 @@ class PriceUpdater { if (this.latestPrices.USD === -1) { this.latestPrices = await PricesRepository.$getLatestConversionRates(); logger.warn(`No BTC price available, falling back to latest known price: ${JSON.stringify(this.latestPrices)}`); + } else { + logger.info(`Latest BTC fiat averaged price: ${JSON.stringify(this.latestPrices)}`); } if (this.ratesChangedCallback && this.latestPrices.USD > 0) { diff --git a/frontend/src/app/app-routing.module.ts b/frontend/src/app/app-routing.module.ts index d1748312d..5f69b55cf 100644 --- a/frontend/src/app/app-routing.module.ts +++ b/frontend/src/app/app-routing.module.ts @@ -7,8 +7,6 @@ import { MempoolBlockViewComponent } from '@components/mempool-block-view/mempoo import { ClockComponent } from '@components/clock/clock.component'; import { StatusViewComponent } from '@components/status-view/status-view.component'; import { AddressGroupComponent } from '@components/address-group/address-group.component'; -import { TrackerComponent } from '@components/tracker/tracker.component'; -import { AccelerateCheckout } from '@components/accelerate-checkout/accelerate-checkout.component'; import { TrackerGuard } from '@app/route-guards'; const browserWindow = window || {};