Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gatsby-worker

Package Overview
Dependencies
Maintainers
19
Versions
169
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gatsby-worker - npm Package Compare versions

Comparing version 0.1.0-next.2 to 0.1.0-next.3

6

CHANGELOG.md

@@ -6,2 +6,8 @@ # Change Log

# [0.1.0-next.3](https://github.com/gatsbyjs/gatsby/compare/gatsby-worker@0.1.0-next.2...gatsby-worker@0.1.0-next.3) (2021-07-14)
### Features
- **gatsby:** restart worker pool after query running in workers ([#32365](https://github.com/gatsbyjs/gatsby/issues/32365)) ([b9236e1](https://github.com/gatsbyjs/gatsby/commit/b9236e16aac8c889c526571738c716cfb520043d))
# [0.1.0-next.2](https://github.com/gatsbyjs/gatsby/compare/gatsby-worker@0.1.0-next.1...gatsby-worker@0.1.0-next.2) (2021-07-08)

@@ -8,0 +14,0 @@

0

dist/child.d.ts

@@ -0,0 +0,0 @@ export interface IGatsbyWorkerMessenger<MessagesFromParent = unknown, MessagesFromChild = MessagesFromParent> {

@@ -24,2 +24,4 @@ interface IWorkerOptions {

export declare class WorkerPool<WorkerModuleExports = Record<string, unknown>, MessagesFromParent = unknown, MessagesFromChild = MessagesFromParent> {
private workerPath;
private options?;
/**

@@ -41,3 +43,4 @@ * Schedule task execution on all workers. Useful for setting up workers

private listeners;
constructor(workerPath: string, options?: IWorkerOptions);
constructor(workerPath: string, options?: IWorkerOptions | undefined);
private startAll;
/**

@@ -48,2 +51,6 @@ * Kills worker processes and rejects and ongoing or pending tasks.

end(): Array<Promise<number | null>>;
/**
* Kills all running worker processes and spawns a new pool of processes
*/
restart(): Promise<void>;
private checkForWork;

@@ -50,0 +57,0 @@ private doWork;

@@ -60,2 +60,4 @@ "use strict";

this.listeners = [];
this.workerPath = workerPath;
this.options = options;
const single = {};

@@ -84,3 +86,8 @@ const all = {};

this.all = all;
this.startAll();
}
startAll() {
const options = this.options;
for (let workerId = 1; workerId <= ((_options$numWorkers = options === null || options === void 0 ? void 0 : options.numWorkers) !== null && _options$numWorkers !== void 0 ? _options$numWorkers : 1); workerId++) {

@@ -94,3 +101,3 @@ var _options$numWorkers, _options$env;

GATSBY_WORKER_ID: workerId.toString(),
GATSBY_WORKER_MODULE_PATH: workerPath
GATSBY_WORKER_MODULE_PATH: this.workerPath
},

@@ -190,6 +197,18 @@ // Suppress --debug / --inspect flags while preserving others (like --harmony).

}
this.workers = [];
this.idleWorkers = new Set();
});
return results;
}
/**
* Kills all running worker processes and spawns a new pool of processes
*/
async restart() {
await Promise.all(this.end());
this.startAll();
}
checkForWork(workerInfo) {

@@ -196,0 +215,0 @@ // check if there is task in queue

@@ -0,0 +0,0 @@ interface ITaskQueueNode<ValueType> {

@@ -0,0 +0,0 @@ export declare const EXECUTE = 1;

export declare const isPromise: (obj: any) => obj is PromiseLike<unknown>;
export declare const isRunning: (pid: number) => boolean;
"use strict";
exports.__esModule = true;
exports.isPromise = void 0;
exports.isRunning = exports.isPromise = void 0;
const isPromise = obj => !!obj && (typeof obj === `object` || typeof obj === `function`) && typeof obj.then === `function`;
exports.isPromise = isPromise;
exports.isPromise = isPromise;
const isRunning = pid => {
try {
// "As a special case, a signal of 0 can be used to test for the existence of a process."
// See https://nodejs.org/api/process.html#process_process_kill_pid_signal
process.kill(pid, 0);
return true;
} catch (e) {
return false;
}
};
exports.isRunning = isRunning;

4

package.json
{
"name": "gatsby-worker",
"description": "Utility to create worker pools",
"version": "0.1.0-next.2",
"version": "0.1.0-next.3",
"author": "Michal Piechowiak<misiek.piechowiak@gmail.com>",

@@ -41,3 +41,3 @@ "bugs": {

},
"gitHead": "ec0444847b2d11ed29feb656c9c7f32ab78e2dc8"
"gitHead": "2d454e48e159e49987e81603b7473703ca18c9a8"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc