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

egg-cluster

Package Overview
Dependencies
Maintainers
12
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

egg-cluster - npm Package Compare versions

Comparing version 2.0.1 to 2.1.0

lib/utils/timer.js

2

lib/agent_worker.js

@@ -27,3 +27,3 @@ 'use strict';

const debug = require('debug')('egg-cluster');
const debug = require('util').debuglog('egg-cluster');
const ConsoleLogger = require('egg-logger').EggConsoleLogger;

@@ -30,0 +30,0 @@ const consoleLogger = new ConsoleLogger({ level: process.env.EGG_AGENT_WORKER_LOGGER_LEVEL });

@@ -20,3 +20,3 @@ 'use strict';

const fs = require('fs');
const debug = require('debug')('egg-cluster');
const debug = require('util').debuglog('egg-cluster');
const ConsoleLogger = require('egg-logger').EggConsoleLogger;

@@ -23,0 +23,0 @@ const consoleLogger = new ConsoleLogger({

@@ -13,3 +13,2 @@ 'use strict';

const utility = require('utility');
const { mkdirp } = require('mz-modules');

@@ -41,2 +40,3 @@ const Manager = require('./utils/manager');

* - {String} [pidFile] will save master pid to this file
* - {String} [env] custom env, default is process.env.EGG_SERVER_ENV
*/

@@ -51,3 +51,3 @@ constructor(options) {

this.isProduction = isProduction();
this.isProduction = isProduction(this.options);
this.agentWorkerIndex = 0;

@@ -62,3 +62,3 @@ this.closed = false;

this.logMethod = 'info';
if (process.env.EGG_SERVER_ENV === 'local' || process.env.NODE_ENV === 'development') {
if (this.options.env === 'local' || process.env.NODE_ENV === 'development') {
this.logMethod = 'debug';

@@ -91,3 +91,3 @@ }

this.log('[master] start with env: isProduction: %s, EGG_SERVER_ENV: %s, NODE_ENV: %s',
this.isProduction, process.env.EGG_SERVER_ENV, process.env.NODE_ENV);
this.isProduction, this.options.env, process.env.NODE_ENV);

@@ -158,3 +158,3 @@ const startTime = Date.now();

if (this.options.pidFile) {
mkdirp.sync(path.dirname(this.options.pidFile));
fs.mkdirSync(path.dirname(this.options.pidFile), { recursive: true });
fs.writeFileSync(this.options.pidFile, process.pid.toString(), 'utf-8');

@@ -595,6 +595,5 @@ }

function isProduction() {
const serverEnv = process.env.EGG_SERVER_ENV;
if (serverEnv) {
return serverEnv !== 'local' && serverEnv !== 'unittest';
function isProduction(options) {
if (options.env) {
return options.env !== 'local' && options.env !== 'unittest';
}

@@ -601,0 +600,0 @@ return process.env.NODE_ENV === 'production';

'use strict';
const debug = require('debug')('egg-cluster:messenger');
const debug = require('util').debuglog('egg-cluster:messenger');
const workerThreads = require('worker_threads');

@@ -5,0 +5,0 @@

'use strict';
const sleep = require('mz-modules/sleep');
const { sleep } = require('../../../timer');
const workerThreads = require('worker_threads');

@@ -5,0 +5,0 @@ const { BaseAppWorker, BaseAppUtils } = require('../../base/app');

@@ -21,2 +21,3 @@ 'use strict';

ports: [],
env: null,
};

@@ -27,2 +28,5 @@ options = extend(defaults, options);

}
if (!options.env && process.env.EGG_SERVER_ENV) {
options.env = process.env.EGG_SERVER_ENV;
}

@@ -29,0 +33,0 @@ const pkgPath = path.join(options.baseDir, 'package.json');

'use strict';
const sleep = require('mz-modules/sleep');
const { sleep } = require('./timer');
const awaitEvent = require('await-event');

@@ -5,0 +5,0 @@ const pstree = require('ps-tree');

{
"name": "egg-cluster",
"version": "2.0.1",
"version": "2.1.0",
"description": "cluster manager for egg",

@@ -9,4 +9,4 @@ "main": "index.js",

"test": "npm run lint -- --fix && npm run test-local",
"test-local": "egg-bin test",
"cov": "egg-bin cov --prerequire --timeout 100000",
"test-local": "egg-bin test --ts false",
"cov": "egg-bin cov --prerequire --timeout 100000 --ts false",
"ci": "npm run lint && npm run cov"

@@ -37,6 +37,5 @@ },

"cluster-reload": "^1.0.2",
"debug": "^4.1.1",
"depd": "^2.0.0",
"detect-port": "^1.3.0",
"egg-logger": "^2.3.2",
"egg-logger": "^3.3.0",
"egg-utils": "^2.4.1",

@@ -46,3 +45,2 @@ "get-ready": "^2.0.1",

"is-type-of": "^1.2.1",
"mz-modules": "^2.1.0",
"ps-tree": "^1.2.0",

@@ -57,3 +55,3 @@ "semver": "^5.6.0",

"egg": "^3.9.0",
"egg-bin": "^5.6.1",
"egg-bin": "^6.4.0",
"egg-errors": "^2.2.0",

@@ -63,7 +61,6 @@ "egg-mock": "^5.4.0",

"eslint-config-egg": "^12.1.0",
"mz": "^2.7.0",
"pedding": "^1.1.0",
"supertest": "^4.0.0",
"ts-node": "^6.0.3",
"typescript": "^2.7.2"
"ts-node": "^10.9.1",
"typescript": "^5.0.4"
},

@@ -70,0 +67,0 @@ "engines": {

# egg-cluster
[![NPM version][npm-image]][npm-url]
[![CI](https://github.com/eggjs/egg-cluster/actions/workflows/nodejs.yml/badge.svg)](https://github.com/eggjs/egg-cluster/actions/workflows/nodejs.yml)
[![Test coverage][codecov-image]][codecov-url]

@@ -17,3 +18,3 @@ [![Known Vulnerabilities][snyk-image]][snyk-url]

Cluster Manager for Egg
Cluster Manager for EggJS

@@ -25,3 +26,3 @@ ---

```bash
$ npm i egg-cluster --save
npm i egg-cluster --save
```

@@ -62,2 +63,3 @@

| ports | `Array` | startup port of each app worker, such as: [7001, 7002, 7003], only effects when the startMode is 'worker_threads' |
| env | `String` | custom env, default is process.env.EGG_SERVER_ENV |

@@ -64,0 +66,0 @@ ## Env

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