wire stoppers

This commit is contained in:
boufni95 2025-03-31 16:24:36 +00:00
parent 164b153c2e
commit 7e77e3c7c1
4 changed files with 9 additions and 9 deletions

View file

@ -3,15 +3,17 @@ import { StateBundler } from "../storage/tlv/stateBundler.js";
import { TlvStorageFactory } from "../storage/tlv/tlvFilesStorageFactory.js"; import { TlvStorageFactory } from "../storage/tlv/tlvFilesStorageFactory.js";
export class Utils { export class Utils {
tlvStorageFactory: TlvStorageFactory
stateBundler: StateBundler stateBundler: StateBundler
settings: MainSettings settings: MainSettings
constructor(settings: MainSettings, tlvStorageFactory: TlvStorageFactory) { constructor(settings: MainSettings) {
this.settings = settings this.settings = settings
this.stateBundler = new StateBundler(settings.storageSettings, tlvStorageFactory) this.tlvStorageFactory = new TlvStorageFactory()
this.stateBundler = new StateBundler(settings.storageSettings, this.tlvStorageFactory)
} }
Stop() { Stop() {
this.stateBundler.Stop() this.stateBundler.Stop()
this.tlvStorageFactory.disconnect()
} }
} }

View file

@ -17,10 +17,9 @@ export type AppData = {
name: string; name: string;
} }
export const initMainHandler = async (log: PubLogger, mainSettings: MainSettings) => { export const initMainHandler = async (log: PubLogger, mainSettings: MainSettings) => {
const tlvStorageFactory = new TlvStorageFactory() const utils = new Utils(mainSettings)
const utils = new Utils(mainSettings, tlvStorageFactory)
const storageManager = new Storage(mainSettings.storageSettings) const storageManager = new Storage(mainSettings.storageSettings)
await storageManager.Connect(log, tlvStorageFactory) await storageManager.Connect(log, utils.tlvStorageFactory)
/* const manualMigration = await TypeOrmMigrationRunner(log, storageManager, mainSettings.storageSettings.dbSettings, process.argv[2]) /* const manualMigration = await TypeOrmMigrationRunner(log, storageManager, mainSettings.storageSettings.dbSettings, process.argv[2])
if (manualMigration) { if (manualMigration) {
return return

View file

@ -10,7 +10,7 @@ export const setupNetwork = async () => {
await core.InitAddress() await core.InitAddress()
await core.Mine(1) await core.Mine(1)
const tlvStorageFactory = new TlvStorageFactory() const tlvStorageFactory = new TlvStorageFactory()
const setupUtils = new Utils(settings, tlvStorageFactory) const setupUtils = new Utils(settings)
const alice = new LND(settings.lndSettings, new LiquidityProvider("", setupUtils, async () => { }, async () => { }), setupUtils, async () => { }, async () => { }, () => { }, () => { }) const alice = new LND(settings.lndSettings, new LiquidityProvider("", setupUtils, async () => { }, async () => { }), setupUtils, async () => { }, async () => { }, () => { }, () => { })
const bob = new LND({ ...settings.lndSettings, mainNode: settings.lndSettings.otherNode }, new LiquidityProvider("", setupUtils, async () => { }, async () => { }), setupUtils, async () => { }, async () => { }, () => { }, () => { }) const bob = new LND({ ...settings.lndSettings, mainNode: settings.lndSettings.otherNode }, new LiquidityProvider("", setupUtils, async () => { }, async () => { }), setupUtils, async () => { }, async () => { }, () => { }, () => { })
await tryUntil<void>(async i => { await tryUntil<void>(async i => {

View file

@ -71,8 +71,7 @@ export const SetupTest = async (d: Describe): Promise<TestBase> => {
const user1 = { userId: u1.info.userId, appUserIdentifier: u1.identifier, appId: app.appId } const user1 = { userId: u1.info.userId, appUserIdentifier: u1.identifier, appId: app.appId }
const user2 = { userId: u2.info.userId, appUserIdentifier: u2.identifier, appId: app.appId } const user2 = { userId: u2.info.userId, appUserIdentifier: u2.identifier, appId: app.appId }
const tlvStorageFactory = new TlvStorageFactory() const extermnalUtils = new Utils(settings)
const extermnalUtils = new Utils(settings, tlvStorageFactory)
const externalAccessToMainLnd = new LND(settings.lndSettings, new LiquidityProvider("", extermnalUtils, async () => { }, async () => { }), extermnalUtils, async () => { }, async () => { }, () => { }, () => { }) const externalAccessToMainLnd = new LND(settings.lndSettings, new LiquidityProvider("", extermnalUtils, async () => { }, async () => { }), extermnalUtils, async () => { }, async () => { }, () => { }, () => { })
await externalAccessToMainLnd.Warmup() await externalAccessToMainLnd.Warmup()