Skip to content

Commit

Permalink
Don't use remote workers when serialization is skipped
Browse files Browse the repository at this point in the history
  • Loading branch information
thebriando committed Oct 24, 2022
1 parent 32bef58 commit d3ec164
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/core/workers/src/WorkerFarm.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,15 @@ export default class WorkerFarm extends EventEmitter {
);
}

createHandle(method: string, shouldSerialize?: boolean): HandleFunction {
createHandle(
method: string,
shouldSerialize: boolean = true,
): HandleFunction {
return async (...args) => {
// Child process workers are slow to start (~600ms).
// While we're waiting, just run on the main thread.
// This significantly speeds up startup time.
if (this.shouldUseRemoteWorkers()) {
if (this.shouldUseRemoteWorkers() && shouldSerialize) {
return this.addCall(method, [...args, false]);
} else {
if (this.options.warmWorkers && this.shouldStartRemoteWorkers()) {
Expand Down

0 comments on commit d3ec164

Please sign in to comment.