log queue name
This commit is contained in:
parent
02db6f030c
commit
9f3e2473e3
3 changed files with 7 additions and 6 deletions
|
|
@ -28,7 +28,7 @@ export default class {
|
|||
async Connect(migrations: Function[], metricsMigrations: Function[]) {
|
||||
const { source, executedMigrations } = await NewDB(this.settings.dbSettings, migrations)
|
||||
this.DB = source
|
||||
this.txQueue = new TransactionsQueue(this.DB)
|
||||
this.txQueue = new TransactionsQueue("main", this.DB)
|
||||
this.userStorage = new UserStorage(this.DB, this.txQueue)
|
||||
this.productStorage = new ProductStorage(this.DB, this.txQueue)
|
||||
this.applicationStorage = new ApplicationStorage(this.DB, this.userStorage, this.txQueue)
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ export default class {
|
|||
async Connect(metricsMigrations: Function[]) {
|
||||
const { source, executedMigrations } = await newMetricsDb(this.settings.dbSettings, metricsMigrations)
|
||||
this.DB = source;
|
||||
this.txQueue = new TransactionsQueue(this.DB)
|
||||
this.txQueue = new TransactionsQueue("metrics", this.DB)
|
||||
return executedMigrations;
|
||||
}
|
||||
async SaveRoutingEvent(event: Partial<RoutingEvent>) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { DataSource, EntityManager, EntityTarget } from "typeorm"
|
||||
import { getLogger } from "../helpers/logger.js"
|
||||
import { PubLogger, getLogger } from "../helpers/logger.js"
|
||||
|
||||
export type TX<T> = (entityManager: EntityManager | DataSource) => Promise<T>
|
||||
export type TxOperation<T> = {
|
||||
|
|
@ -11,9 +11,10 @@ export default class {
|
|||
DB: DataSource | EntityManager
|
||||
pendingTx: boolean
|
||||
transactionsQueue: { op: TxOperation<any>, res: (v: any) => void, rej: (message: string) => void }[] = []
|
||||
log = getLogger({})
|
||||
constructor(DB: DataSource | EntityManager) {
|
||||
log: PubLogger
|
||||
constructor(name: string, DB: DataSource | EntityManager) {
|
||||
this.DB = DB
|
||||
this.log = getLogger({ appName: name })
|
||||
}
|
||||
|
||||
PushToQueue<T>(op: TxOperation<T>) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue