this.run(message)
} else if (message.kill === true) {
// Kill message received
- !this.isMain && this.stopCheckActive()
- this.emitDestroy()
+ this.handleKillMessage(message)
}
}
}
+ /**
+ * Handles a kill message sent by the main worker.
+ *
+ * @param message - The kill message.
+ */
+ protected handleKillMessage (message: MessageValue<Data>): void {
+ !this.isMain && this.stopCheckActive()
+ this.emitDestroy()
+ }
+
/**
* Starts the worker check active interval.
*/
this.activeInterval = setInterval(
this.checkActive.bind(this),
(this.opts.maxInactiveTime ?? DEFAULT_MAX_INACTIVE_TIME) / 2
- ).unref()
+ )
+ this.activeInterval.unref()
}
/**