this.opts.killBehavior = opts.killBehavior ?? DEFAULT_KILL_BEHAVIOR
this.opts.maxInactiveTime =
opts.maxInactiveTime ?? DEFAULT_MAX_INACTIVE_TIME
- this.opts.async = opts.async ?? false
+ delete this.opts.async
}
/**
): void {
try {
const startTimestamp = performance.now()
+ const waitTime = startTimestamp - (message.submissionTimestamp ?? 0)
const res = fn(message.data)
const runTime = performance.now() - startTimestamp
this.sendToMainWorker({
data: res,
id: message.id,
- runTime
+ runTime,
+ waitTime
})
} catch (e) {
const err = this.handleError(e as Error)
message: MessageValue<Data>
): void {
const startTimestamp = performance.now()
+ const waitTime = startTimestamp - (message.submissionTimestamp ?? 0)
fn(message.data)
.then(res => {
const runTime = performance.now() - startTimestamp
this.sendToMainWorker({
data: res,
id: message.id,
- runTime
+ runTime,
+ waitTime
})
return null
})