Skip to content

Commit

Permalink
refactor(was-code service): catch db code fetch exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
rumgrum committed Jun 11, 2024
1 parent 1e19217 commit 8f708f1
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions src/services/wasm-codes/wasm-code.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,20 +88,23 @@ export class WasmCodeService implements WasmCodeAdapter {
}

async reloadWasmCodeIdsFromDB(): Promise<void> {
const wasmCodesFromDB = await WasmCodeKey.findAllWithIds()

const wasmCodes = wasmCodesFromDB.map(
(wasmCodeKey: WasmCodeKey) =>
new WasmCode(
wasmCodeKey.codeKey,
wasmCodeKey.codeKeyIds.map(
(wasmCodeKeyId: WasmCodeKeyId) => wasmCodeKeyId.codeKeyId
try {
const wasmCodesFromDB = await WasmCodeKey.findAllWithIds()

const wasmCodes = wasmCodesFromDB.map(
(wasmCodeKey: WasmCodeKey) =>
new WasmCode(
wasmCodeKey.codeKey,
wasmCodeKey.codeKeyIds.map(
(wasmCodeKeyId: WasmCodeKeyId) => wasmCodeKeyId.codeKeyId
)
)
)
)

this.resetWasmCodes()
this.addWasmCodes(wasmCodes)
)
this.resetWasmCodes()
this.addWasmCodes(wasmCodes)
} catch (error) {
console.error('Failed to reload wasm code ids from DB:', error)
}
}

startUpdater(): void {
Expand Down

0 comments on commit 8f708f1

Please sign in to comment.