Skip to content

Commit 96c8752

Browse files
committed
chore: log the internal time it takes to execute worker methods
1 parent dfed87a commit 96c8752

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

shared/packages/worker/src/worker/accessorHandlers/quantel.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ export class QuantelAccessorHandle<Metadata> extends GenericAccessorHandle<Metad
201201
sourceIsPlaceholder: true,
202202
reason: {
203203
user: `Reserved clip, not yet ready for playout`,
204-
tech: `Clip "${clipSummary.ClipGUID}" has no frames`,
204+
tech: `Clip "${clipSummary.ClipGUID}" has "${clipSummary.Frames}" frames`,
205205
},
206206
}
207207
}

shared/packages/worker/src/workerAgent.ts

+11-5
Original file line numberDiff line numberDiff line change
@@ -790,8 +790,11 @@ export class WorkerAgent {
790790
}, 200)
791791
})
792792
try {
793+
const startTime = performance.now()
793794
const result = await ((fcn as any)(...args) as ReturnType<typeof fcn>)
794795

796+
this.logger.debug(`Operation "${key}" took ${Math.floor(performance.now() - startTime)}ms`)
797+
795798
let knownReason = true
796799
if (result) {
797800
// This is a bit of a hack, to access the various result properties type safely:
@@ -936,11 +939,14 @@ export class WorkerAgent {
936939
if (this.failureCounter === 0) {
937940
// reset the failurePeriodCounter when there were no exceptions in the period
938941

939-
this.logger.debug(
940-
`Worker ErrorCheck: There was a period with 0 errors, resetting failurePeriodCounter (from ${this.failurePeriodCounter})`
941-
)
942-
this.failurePeriodCounter = 0
943-
// everything seems fine
942+
if (this.failurePeriodCounter > 0) {
943+
this.logger.debug(
944+
`Worker ErrorCheck: There was a period with 0 errors, resetting failurePeriodCounter (from ${this.failurePeriodCounter})`
945+
)
946+
this.failurePeriodCounter = 0
947+
} else {
948+
this.logger.debug(`Worker ErrorCheck: There was a period with 0 errors`)
949+
}
944950
return
945951
}
946952

0 commit comments

Comments
 (0)