From acb1744a6947b9c4f177311cd25ec2f9b41d1f40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Estev=C3=A3o?= Date: Wed, 26 Nov 2025 19:57:55 -0300 Subject: [PATCH 1/3] fix: missing prices --- jobs/workers.ts | 1 + services/priceService.ts | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/jobs/workers.ts b/jobs/workers.ts index eaa5bbb6..589b3481 100644 --- a/jobs/workers.ts +++ b/jobs/workers.ts @@ -36,6 +36,7 @@ export const syncBlockchainAndPricesWorker = async (queueName: string): Promise< queueName, async (job) => { console.log(`job ${job.id as string}: syncing missed transactions and connecting prices...`) + await priceService.syncPastDaysNewerPrices() await multiBlockchainClient.syncMissedTransactions() await connectAllTransactionsToPrices() }, diff --git a/services/priceService.ts b/services/priceService.ts index 2c75153c..b015121c 100644 --- a/services/priceService.ts +++ b/services/priceService.ts @@ -2,7 +2,7 @@ import axios from 'axios' import { Prisma, Price } from '@prisma/client' import config from 'config' import prisma from 'prisma-local/clientInstance' -import { PRICE_API_TIMEOUT, PRICE_API_MAX_RETRIES, PRICE_API_DATE_FORMAT, RESPONSE_MESSAGES, NETWORK_TICKERS, XEC_NETWORK_ID, BCH_NETWORK_ID, USD_QUOTE_ID, CAD_QUOTE_ID, N_OF_QUOTES } from 'constants/index' +import { PRICE_API_TIMEOUT, PRICE_API_MAX_RETRIES, PRICE_API_DATE_FORMAT, RESPONSE_MESSAGES, NETWORK_TICKERS, XEC_NETWORK_ID, BCH_NETWORK_ID, USD_QUOTE_ID, CAD_QUOTE_ID, N_OF_QUOTES, HUMAN_READABLE_DATE_FORMAT } from 'constants/index' import { validatePriceAPIUrlAndToken, validateNetworkTicker } from 'utils/validators' import moment from 'moment' @@ -165,10 +165,12 @@ export async function syncPastDaysNewerPrices (): Promise { const date = moment().startOf('day') const daysToRetrieve: string[] = [] + console.log(`[PRICES] Last price found is for ${lastDateInDB.format(HUMAN_READABLE_DATE_FORMAT)}.`) while (date.isAfter(lastDateInDB)) { daysToRetrieve.push(date.format(PRICE_API_DATE_FORMAT)) date.add(-1, 'day') } + console.log(`[PRICES] Will try to retrieve ${daysToRetrieve.length} prices.`) const allXECPrices = await getAllPricesByNetworkTicker(NETWORK_TICKERS.ecash, false) const allBCHPrices = await getAllPricesByNetworkTicker(NETWORK_TICKERS.bitcoincash, false) From 1b7fea7320f084f4cc45884f48b24ba143bf500b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Estev=C3=A3o?= Date: Wed, 26 Nov 2025 20:09:43 -0300 Subject: [PATCH 2/3] fix: env var names --- docker-compose-from-dump.yml | 8 ++++---- docker-compose.yml | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docker-compose-from-dump.yml b/docker-compose-from-dump.yml index f9a5c5f8..da676c50 100644 --- a/docker-compose-from-dump.yml +++ b/docker-compose-from-dump.yml @@ -28,10 +28,10 @@ services: - .env.local - .env.from-dump environment: - MYSQL_ROOT_PASSWORD: ${MAIN_DB_ROOT_PASSWORD} - MYSQL_DATABASE: ${MAIN_DB_NAME} - MYSQL_USER: ${MAIN_DB_USER} - MYSQL_PASSWORD: ${MAIN_DB_PASSWORD} + MARIADB_ROOT_PASSWORD: ${MAIN_DB_ROOT_PASSWORD} + MARIADB_DATABASE: ${MAIN_DB_NAME} + MARIADB_USER: ${MAIN_DB_USER} + MARIADB_PASSWORD: ${MAIN_DB_PASSWORD} command: --default-authentication-plugin=mysql_native_password ports: - 3306:3306 diff --git a/docker-compose.yml b/docker-compose.yml index c75ef9b8..74042655 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -25,10 +25,10 @@ services: - .env - .env.local environment: - MYSQL_ROOT_PASSWORD: ${MAIN_DB_ROOT_PASSWORD} - MYSQL_DATABASE: ${MAIN_DB_NAME} - MYSQL_USER: ${MAIN_DB_USER} - MYSQL_PASSWORD: ${MAIN_DB_PASSWORD} + MARIADB_ROOT_PASSWORD: ${MAIN_DB_ROOT_PASSWORD} + MARIADB_DATABASE: ${MAIN_DB_NAME} + MARIADB_USER: ${MAIN_DB_USER} + MARIADB_PASSWORD: ${MAIN_DB_PASSWORD} command: --default-authentication-plugin=mysql_native_password ports: - 3306:3306 From 3fd6d6a2220a40731fd2e613584898c323bb6848 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Estev=C3=A3o?= Date: Wed, 26 Nov 2025 20:12:59 -0300 Subject: [PATCH 3/3] fix: log --- jobs/workers.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jobs/workers.ts b/jobs/workers.ts index 589b3481..d913176f 100644 --- a/jobs/workers.ts +++ b/jobs/workers.ts @@ -35,7 +35,7 @@ export const syncBlockchainAndPricesWorker = async (queueName: string): Promise< const worker = new Worker( queueName, async (job) => { - console.log(`job ${job.id as string}: syncing missed transactions and connecting prices...`) + console.log(`job ${job.id as string}: syncing missed prices, transactions and connecting them...`) await priceService.syncPastDaysNewerPrices() await multiBlockchainClient.syncMissedTransactions() await connectAllTransactionsToPrices()