diff --git a/bfx-report-ui b/bfx-report-ui index a94ca364b..d825d4460 160000 --- a/bfx-report-ui +++ b/bfx-report-ui @@ -1 +1 @@ -Subproject commit a94ca364bd79d2852a69f86cc18ddefff860e895 +Subproject commit d825d4460ff9c8300bdfd1a2e9ad489a82bfbd66 diff --git a/package.json b/package.json index 98febd932..28369df97 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bfx-reports-framework", - "version": "4.16.0", + "version": "4.17.0", "description": "Bitfinex reports framework", "main": "worker.js", "license": "Apache-2.0", diff --git a/workers/api.framework.report.wrk.js b/workers/api.framework.report.wrk.js index e818d593a..17584ee6d 100644 --- a/workers/api.framework.report.wrk.js +++ b/workers/api.framework.report.wrk.js @@ -1,5 +1,7 @@ 'use strict' +const fs = require('node:fs') + const WrkReportServiceApi = require( 'bfx-report/workers/api.service.report.wrk' ) @@ -143,6 +145,31 @@ class WrkReportFrameWorkApi extends WrkReportServiceApi { } this.setInitFacs(facs) + this.rmLokueDbIfJSONDamaged() + } + + rmLokueDbIfJSONDamaged () { + for (const fac of this.conf.init.facilities) { + // eslint-disable-next-line no-unused-vars + const [type, facName, ns, label, opts] = fac + + if (facName !== 'bfx-facs-lokue') { + continue + } + + const { dbPathAbsolute, name } = opts + const baseLokueDbFileName = ['lokue', name, label].join('_') + const pathToLokueDbFile = path.join( + dbPathAbsolute, + `${baseLokueDbFileName}.db.json` + ) + + try { + require(pathToLokueDbFile) + } catch (err) { + fs.rmSync(pathToLokueDbFile, { force: true, maxRetries: 3 }) + } + } } async initService (deps) { diff --git a/workers/loc.api/sync/progress/index.js b/workers/loc.api/sync/progress/index.js index 91b17b90b..e51149dbb 100644 --- a/workers/loc.api/sync/progress/index.js +++ b/workers/loc.api/sync/progress/index.js @@ -95,8 +95,14 @@ class Progress extends EventEmitter { return } + const serializedError = ( + progress?.serializedError ?? + progress?.stack ?? + progress + ) + this.logger.error( - `PROGRESS:SYNC: ${progress.stack || progress}` + `PROGRESS:SYNC: ${serializedError}` ) }