gatsby-worker
Advanced tools
Comparing version 1.11.0-next.0 to 1.11.0-next.1
@@ -6,2 +6,8 @@ # Changelog: `gatsby-worker` | ||
## [1.10.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-worker@1.10.0/packages/gatsby-worker) (2022-03-16) | ||
[🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v4.10) | ||
**Note:** Version bump only for package gatsby-worker | ||
## [1.9.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-worker@1.9.0/packages/gatsby-worker) (2022-03-01) | ||
@@ -8,0 +14,0 @@ |
@@ -86,2 +86,3 @@ "use strict"; | ||
process.on(`message`, messageHandler); | ||
ensuredSendToMain([_types.WORKER_READY]); | ||
} |
@@ -106,5 +106,9 @@ "use strict"; | ||
}); | ||
let workerReadyResolve; | ||
const workerInfo = { | ||
workerId, | ||
worker, | ||
ready: new Promise(resolve => { | ||
workerReadyResolve = resolve; | ||
}), | ||
exitedPromise: new Promise(resolve => { | ||
@@ -167,2 +171,4 @@ worker.on(`exit`, (code, signal) => { | ||
} | ||
} else if (msg[0] === _types.WORKER_READY) { | ||
workerReadyResolve(); | ||
} | ||
@@ -238,6 +244,7 @@ }); | ||
doWork(taskInfo, workerInfo) { | ||
async doWork(taskInfo, workerInfo) { | ||
// block worker | ||
workerInfo.currentTask = taskInfo; | ||
this.idleWorkers.delete(workerInfo); | ||
await workerInfo.ready; | ||
const msg = [_types.EXECUTE, taskInfo.functionName, taskInfo.args]; | ||
@@ -244,0 +251,0 @@ workerInfo.worker.send(msg); |
@@ -6,2 +6,3 @@ export declare const EXECUTE = 1; | ||
export declare const CUSTOM_MESSAGE = 4; | ||
export declare const WORKER_READY = 8; | ||
declare type CustomMessage = [typeof CUSTOM_MESSAGE, unknown]; | ||
@@ -12,2 +13,3 @@ declare type FunctionName = string | number | symbol; | ||
declare type EndMessage = [typeof END]; | ||
declare type WorkerReadyMessage = [typeof WORKER_READY]; | ||
export declare type ParentMessageUnion = ExecuteMessage | EndMessage | CustomMessage; | ||
@@ -26,3 +28,3 @@ declare type ErrorType = string; | ||
declare type TaskResult = [typeof RESULT, ResultType]; | ||
export declare type ChildMessageUnion = TaskError | TaskResult | CustomMessage; | ||
export declare type ChildMessageUnion = TaskError | TaskResult | CustomMessage | WorkerReadyMessage; | ||
export {}; |
"use strict"; | ||
exports.__esModule = true; | ||
exports.CUSTOM_MESSAGE = exports.END = exports.RESULT = exports.ERROR = exports.EXECUTE = void 0; | ||
exports.WORKER_READY = exports.CUSTOM_MESSAGE = exports.END = exports.RESULT = exports.ERROR = exports.EXECUTE = void 0; | ||
const EXECUTE = 0b01; | ||
@@ -14,2 +14,4 @@ exports.EXECUTE = EXECUTE; | ||
const CUSTOM_MESSAGE = 0b100; | ||
exports.CUSTOM_MESSAGE = CUSTOM_MESSAGE; | ||
exports.CUSTOM_MESSAGE = CUSTOM_MESSAGE; | ||
const WORKER_READY = 0b1000; | ||
exports.WORKER_READY = WORKER_READY; |
{ | ||
"name": "gatsby-worker", | ||
"description": "Utility to create worker pools", | ||
"version": "1.11.0-next.0", | ||
"version": "1.11.0-next.1", | ||
"author": "Michal Piechowiak<misiek.piechowiak@gmail.com>", | ||
@@ -42,3 +42,3 @@ "bugs": { | ||
}, | ||
"gitHead": "e0f8815c007b7915f4d69264b8a5714a4c0ed31b" | ||
"gitHead": "045dbf3d8ee55bd6d0abedb9c022bfac71d255fb" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
36000
532