diff --git a/backend/src/api/services/acceleration.ts b/backend/src/api/services/acceleration.ts index 635dc8300..99bb963ee 100644 --- a/backend/src/api/services/acceleration.ts +++ b/backend/src/api/services/acceleration.ts @@ -1,6 +1,7 @@ -import { query } from '../../utils/axios-query'; import config from '../../config'; +import logger from '../../logger'; import { BlockExtended, PoolTag } from '../../mempool.interfaces'; +import axios from 'axios'; export interface Acceleration { txid: string, @@ -9,10 +10,15 @@ export interface Acceleration { } class AccelerationApi { - public async $fetchAccelerations(): Promise { + public async $fetchAccelerations(): Promise { if (config.MEMPOOL_SERVICES.ACCELERATIONS) { - const response = await query(`${config.MEMPOOL_SERVICES.API}/accelerator/accelerations`); - return (response as Acceleration[]) || []; + try { + const response = await axios.get(`${config.MEMPOOL_SERVICES.API}/accelerator/accelerations`, { responseType: 'json', timeout: 10000 }); + return response.data as Acceleration[]; + } catch (e) { + logger.warn('Failed to fetch current accelerations from the mempool services backend: ' + (e instanceof Error ? e.message : e)); + return null; + } } else { return []; }