Skip to content

Commit

Permalink
fix: service.stop undefined on error
Browse files Browse the repository at this point in the history
  • Loading branch information
wsdt committed Mar 19, 2024
1 parent 654bbf3 commit 6043662
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion src/exec/lightbridge-instance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,15 @@ export const startLightBridgeForNetwork = async (opts: ILightBridgeOpts) => {
err
)
} finally {
await service.stop()
try {
await service?.stop()
} catch(err) {
console.error(
`Could not stop Lightbridge instance for ${opts.rpcUrl} (rpcUrl), ${opts.envModeIsDevelopment} (envMode), ${opts.networkMode} (networkMode).`,
err?.message,
err
)
}
}
await delay(opts.retryIntervalMs ?? 120000)
}
Expand Down
2 changes: 1 addition & 1 deletion src/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ export class LightBridgeService extends BaseService<TeleportationOptions> {
}
await sleep(this.options.pollingInterval)
this.logger.info('Disbursed teleportations for networks', {
chainIds: this.state.depositTeleportations.map(c => c.chainId),
chainIds: this.state.depositTeleportations.map((c) => c.chainId),
serviceChainId: this.options.chainId,
})
}
Expand Down

0 comments on commit 6043662

Please sign in to comment.