这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
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
27 changes: 27 additions & 0 deletions workers/api.framework.report.wrk.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
'use strict'

const fs = require('node:fs')

const WrkReportServiceApi = require(
'bfx-report/workers/api.service.report.wrk'
)
Expand Down Expand Up @@ -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) {
Expand Down