Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions docker-compose-from-dump.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion jobs/workers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
},
Expand Down
4 changes: 3 additions & 1 deletion services/priceService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down Expand Up @@ -165,10 +165,12 @@ export async function syncPastDaysNewerPrices (): Promise<void> {
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)
Expand Down