diff --git a/src/services/storage/storageInterface.ts b/src/services/storage/storageInterface.ts index 9a491c16..7583a1a3 100644 --- a/src/services/storage/storageInterface.ts +++ b/src/services/storage/storageInterface.ts @@ -14,17 +14,23 @@ import { import { PickKeysByType } from 'typeorm/common/PickKeysByType.js'; import { serializeRequest, WhereCondition } from './serializationHelpers.js'; + export type TX = (txId: string) => Promise export class StorageInterface extends EventEmitter { private process: any; private isConnected: boolean = false; + private debug: boolean = false; constructor() { super(); this.initializeSubprocess(); } + setDebug(debug: boolean) { + this.debug = debug; + } + private initializeSubprocess() { this.process = fork('./build/src/services/storage/storageProcessor'); @@ -131,11 +137,11 @@ export class StorageInterface extends EventEmitter { } private handleOp(op: IStorageOperation): Promise { - console.log('handleOp', op) + if (this.debug) console.log('handleOp', op) this.checkConnected() return new Promise((resolve, reject) => { const responseHandler = (response: OperationResponse) => { - console.log('responseHandler', response) + if (this.debug) console.log('responseHandler', response) if (!response.success) { reject(new Error(response.error)); return @@ -169,6 +175,7 @@ export class StorageInterface extends EventEmitter { if (this.process) { this.process.kill(); this.isConnected = false; + this.debug = false; } } -} \ No newline at end of file +} \ No newline at end of file diff --git a/src/tests/adminChannels.spec.ts b/src/tests/adminChannels.spec.ts index b8b48f8b..819e5490 100644 --- a/src/tests/adminChannels.spec.ts +++ b/src/tests/adminChannels.spec.ts @@ -4,6 +4,7 @@ export const ignore = false export const dev = false export default async (T: TestBase) => { + T.main.storage.dbs.setDebug(true) await safelySetUserBalance(T, T.user1, 2000) await openAdminChannel(T) await runSanityCheck(T)