less spam
This commit is contained in:
parent
473fc38457
commit
005add84bd
2 changed files with 11 additions and 3 deletions
|
|
@ -14,17 +14,23 @@ import {
|
||||||
import { PickKeysByType } from 'typeorm/common/PickKeysByType.js';
|
import { PickKeysByType } from 'typeorm/common/PickKeysByType.js';
|
||||||
import { serializeRequest, WhereCondition } from './serializationHelpers.js';
|
import { serializeRequest, WhereCondition } from './serializationHelpers.js';
|
||||||
|
|
||||||
|
|
||||||
export type TX<T> = (txId: string) => Promise<T>
|
export type TX<T> = (txId: string) => Promise<T>
|
||||||
|
|
||||||
export class StorageInterface extends EventEmitter {
|
export class StorageInterface extends EventEmitter {
|
||||||
private process: any;
|
private process: any;
|
||||||
private isConnected: boolean = false;
|
private isConnected: boolean = false;
|
||||||
|
private debug: boolean = false;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
this.initializeSubprocess();
|
this.initializeSubprocess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setDebug(debug: boolean) {
|
||||||
|
this.debug = debug;
|
||||||
|
}
|
||||||
|
|
||||||
private initializeSubprocess() {
|
private initializeSubprocess() {
|
||||||
this.process = fork('./build/src/services/storage/storageProcessor');
|
this.process = fork('./build/src/services/storage/storageProcessor');
|
||||||
|
|
||||||
|
|
@ -131,11 +137,11 @@ export class StorageInterface extends EventEmitter {
|
||||||
}
|
}
|
||||||
|
|
||||||
private handleOp<T>(op: IStorageOperation): Promise<T> {
|
private handleOp<T>(op: IStorageOperation): Promise<T> {
|
||||||
console.log('handleOp', op)
|
if (this.debug) console.log('handleOp', op)
|
||||||
this.checkConnected()
|
this.checkConnected()
|
||||||
return new Promise<T>((resolve, reject) => {
|
return new Promise<T>((resolve, reject) => {
|
||||||
const responseHandler = (response: OperationResponse<T>) => {
|
const responseHandler = (response: OperationResponse<T>) => {
|
||||||
console.log('responseHandler', response)
|
if (this.debug) console.log('responseHandler', response)
|
||||||
if (!response.success) {
|
if (!response.success) {
|
||||||
reject(new Error(response.error));
|
reject(new Error(response.error));
|
||||||
return
|
return
|
||||||
|
|
@ -169,6 +175,7 @@ export class StorageInterface extends EventEmitter {
|
||||||
if (this.process) {
|
if (this.process) {
|
||||||
this.process.kill();
|
this.process.kill();
|
||||||
this.isConnected = false;
|
this.isConnected = false;
|
||||||
|
this.debug = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -4,6 +4,7 @@ export const ignore = false
|
||||||
export const dev = false
|
export const dev = false
|
||||||
|
|
||||||
export default async (T: TestBase) => {
|
export default async (T: TestBase) => {
|
||||||
|
T.main.storage.dbs.setDebug(true)
|
||||||
await safelySetUserBalance(T, T.user1, 2000)
|
await safelySetUserBalance(T, T.user1, 2000)
|
||||||
await openAdminChannel(T)
|
await openAdminChannel(T)
|
||||||
await runSanityCheck(T)
|
await runSanityCheck(T)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue