this.aliveInterval = setInterval(
this.checkAlive.bind(this),
(this.opts.maxInactiveTime ?? DEFAULT_MAX_INACTIVE_TIME) / 2
this.aliveInterval = setInterval(
this.checkAlive.bind(this),
(this.opts.maxInactiveTime ?? DEFAULT_MAX_INACTIVE_TIME) / 2
(this.opts.maxInactiveTime ?? DEFAULT_MAX_INACTIVE_TIME)
) {
this.sendToMainWorker({ kill: this.opts.killBehavior })
(this.opts.maxInactiveTime ?? DEFAULT_MAX_INACTIVE_TIME)
) {
this.sendToMainWorker({ kill: this.opts.killBehavior })
- const runTime = Date.now() - startTimestamp
- this.sendToMainWorker({ data: res, id: message.id, runTime })
+ const runTime = performance.now() - startTimestamp
+ this.sendToMainWorker({
+ data: res,
+ id: message.id,
+ runTime
+ })
} catch (e) {
const err = this.handleError(e as Error)
this.sendToMainWorker({ error: err, id: message.id })
} finally {
} catch (e) {
const err = this.handleError(e as Error)
this.sendToMainWorker({ error: err, id: message.id })
} finally {
fn: (data?: Data) => Promise<Response>,
message: MessageValue<Data>
): void {
fn: (data?: Data) => Promise<Response>,
message: MessageValue<Data>
): void {
- const runTime = Date.now() - startTimestamp
- this.sendToMainWorker({ data: res, id: message.id, runTime })
+ const runTime = performance.now() - startTimestamp
+ this.sendToMainWorker({
+ data: res,
+ id: message.id,
+ runTime
+ })