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 diff --git a/jobs/workers.ts b/jobs/workers.ts index eaa5bbb6..d913176f 100644 --- a/jobs/workers.ts +++ b/jobs/workers.ts @@ -35,7 +35,8 @@ 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() }, 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)