cluster-client
Advanced tools
Comparing version 3.4.0 to 3.4.1
'use strict'; | ||
const debug = require('debug')('cluster-client#follower'); | ||
const debug = require('util').debuglog('cluster-client#follower'); | ||
const is = require('is-type-of'); | ||
@@ -5,0 +5,0 @@ const Base = require('tcp-base'); |
'use strict'; | ||
const debug = require('debug')('cluster-client#leader'); | ||
const debug = require('util').debuglog('cluster-client#leader'); | ||
const co = require('co'); | ||
@@ -324,7 +324,8 @@ const is = require('is-type-of'); | ||
if (err) { | ||
const data = Object.assign({ | ||
const data = { | ||
stack: err.stack, | ||
name: err.name, | ||
message: err.message, | ||
}, err); | ||
code: err.code, | ||
}; | ||
err.method = connObj.method; | ||
@@ -363,7 +364,8 @@ err.args = connObj.args; | ||
res.connObj = { type: 'register_channel_res' }; | ||
const data = Object.assign({ | ||
const data = { | ||
message: err.message, | ||
stack: err.stack, | ||
name: err.name, | ||
}, err); | ||
code: err.code, | ||
}; | ||
res.data = this._transcode.encode({ | ||
@@ -370,0 +372,0 @@ success: false, |
@@ -1,5 +0,5 @@ | ||
const debug = require('debug')('cluster-client:lib:server'); | ||
const debug = require('util').debuglog('cluster-client:lib:server'); | ||
const net = require('net'); | ||
const Base = require('sdk-base'); | ||
const sleep = require('mz-modules/sleep'); | ||
const { sleep } = require('./utils'); | ||
const Packet = require('./protocol/packet'); | ||
@@ -6,0 +6,0 @@ |
@@ -98,1 +98,7 @@ 'use strict'; | ||
}; | ||
exports.sleep = ms => { | ||
return new Promise(resolve => { | ||
setTimeout(resolve, ms); | ||
}); | ||
}; |
'use strict'; | ||
const debug = require('debug')('cluster-client:lib:wrapper:base'); | ||
const debug = require('util').debuglog('cluster-client:lib:wrapper:base'); | ||
const is = require('is-type-of'); | ||
@@ -5,0 +5,0 @@ const Base = require('sdk-base'); |
'use strict'; | ||
const debug = require('debug')('cluster-client:lib:wrapper:cluster'); | ||
const debug = require('util').debuglog('cluster-client:lib:wrapper:cluster'); | ||
const Base = require('./base'); | ||
@@ -5,0 +5,0 @@ const Leader = require('../leader'); |
{ | ||
"name": "cluster-client", | ||
"version": "3.4.0", | ||
"version": "3.4.1", | ||
"description": "Sharing Connection among Multi-Process Nodejs", | ||
@@ -12,7 +12,6 @@ "main": "./index.js", | ||
"lint": "eslint . --ext .js", | ||
"cov": "egg-bin cov --timeout 20000", | ||
"test": "npm run lint && npm run test-local", | ||
"test-local": "egg-bin test", | ||
"ci": "npm run lint && npm run cov", | ||
"contributors": "contributors -f plain -o AUTHORS" | ||
"ci": "egg-bin cov", | ||
"contributor": "git-contributor" | ||
}, | ||
@@ -36,3 +35,2 @@ "repository": { | ||
"co": "^4.6.0", | ||
"debug": "^4.1.1", | ||
"egg-logger": "^2.3.2", | ||
@@ -42,3 +40,2 @@ "is-type-of": "^1.2.1", | ||
"long": "^4.0.0", | ||
"mz-modules": "^2.1.0", | ||
"sdk-base": "^3.5.1", | ||
@@ -53,10 +50,9 @@ "serialize-json": "^1.0.3", | ||
"coffee": "^5.2.1", | ||
"contributors": "^0.5.1", | ||
"detect-port": "^1.3.0", | ||
"egg-bin": "^5.6.1", | ||
"egg-bin": "^6.4.1", | ||
"egg-mock": "^5.4.0", | ||
"eslint": "^8.30.0", | ||
"eslint-config-egg": "^12.1.0", | ||
"git-contributor": "^2.1.5", | ||
"mm": "^2.4.1", | ||
"mz-modules": "^2.1.0", | ||
"pedding": "^1.1.0", | ||
@@ -63,0 +59,0 @@ "spy": "^1.0.0" |
# cluster-client | ||
Sharing Connection among Multi-Process Nodejs | ||
@@ -34,2 +35,3 @@ | ||
normal (without using cluster client) | ||
```js | ||
@@ -50,2 +52,3 @@ +--------+ +--------+ | ||
using cluster-client | ||
```js | ||
@@ -80,2 +83,3 @@ +-------+ | ||
- Packet structure | ||
```js | ||
@@ -93,2 +97,3 @@ 0 1 2 4 12 | ||
``` | ||
- Protocol Type | ||
@@ -122,3 +127,3 @@ - Register Channel | ||
```bash | ||
$ npm install cluster-client --save | ||
npm install cluster-client --save | ||
``` | ||
@@ -219,9 +224,13 @@ | ||
1. DataClient | ||
- Only provider data API, interact with server and maintain persistent connections etc. | ||
- No need to concern `cluster` issue | ||
2. APIClient | ||
- Using `cluster-client` to wrap DataClient | ||
- Put your bussiness logic here | ||
**DataClient** | ||
- Only provider data API, interact with server and maintain persistent connections etc. | ||
- No need to concern `cluster` issue | ||
1. APIClient | ||
- Using `cluster-client` to wrap DataClient | ||
- Put your bussiness logic here | ||
### DataClient | ||
```js | ||
@@ -250,3 +259,4 @@ const Base = require('sdk-base'); | ||
**APIClient** | ||
### APIClient | ||
```js | ||
@@ -305,1 +315,13 @@ const DataClient = require('./your-data-client'); | ||
[MIT](LICENSE) | ||
<!-- GITCONTRIBUTOR_START --> | ||
## Contributors | ||
|[<img src="https://avatars.githubusercontent.com/u/1207064?v=4" width="100px;"/><br/><sub><b>gxcsoccer</b></sub>](https://github.com/gxcsoccer)<br/>|[<img src="https://avatars.githubusercontent.com/u/156269?v=4" width="100px;"/><br/><sub><b>fengmk2</b></sub>](https://github.com/fengmk2)<br/>|[<img src="https://avatars.githubusercontent.com/u/456108?v=4" width="100px;"/><br/><sub><b>shaoshuai0102</b></sub>](https://github.com/shaoshuai0102)<br/>|[<img src="https://avatars.githubusercontent.com/u/6897780?v=4" width="100px;"/><br/><sub><b>killagu</b></sub>](https://github.com/killagu)<br/>|[<img src="https://avatars.githubusercontent.com/u/32174276?v=4" width="100px;"/><br/><sub><b>semantic-release-bot</b></sub>](https://github.com/semantic-release-bot)<br/>|[<img src="https://avatars.githubusercontent.com/u/227713?v=4" width="100px;"/><br/><sub><b>atian25</b></sub>](https://github.com/atian25)<br/>| | ||
| :---: | :---: | :---: | :---: | :---: | :---: | | ||
[<img src="https://avatars.githubusercontent.com/u/546535?v=4" width="100px;"/><br/><sub><b>leoner</b></sub>](https://github.com/leoner)<br/>|[<img src="https://avatars.githubusercontent.com/u/2160731?v=4" width="100px;"/><br/><sub><b>mansonchor</b></sub>](https://github.com/mansonchor)<br/>|[<img src="https://avatars.githubusercontent.com/u/19849579?v=4" width="100px;"/><br/><sub><b>sinkhaha</b></sub>](https://github.com/sinkhaha)<br/>|[<img src="https://avatars.githubusercontent.com/u/6457450?v=4" width="100px;"/><br/><sub><b>limitMe</b></sub>](https://github.com/limitMe)<br/> | ||
This project follows the git-contributor [spec](https://github.com/xudafeng/git-contributor), auto updated at `Tue Jun 20 2023 12:29:14 GMT+0800`. | ||
<!-- GITCONTRIBUTOR_END --> |
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
76209
10
12
2058
320
- Removeddebug@^4.1.1
- Removedmz-modules@^2.1.0
- Removedbalanced-match@1.0.2(transitive)
- Removedbrace-expansion@1.1.11(transitive)
- Removedconcat-map@0.0.1(transitive)
- Removeddebug@4.4.0(transitive)
- Removedend-of-stream@1.4.4(transitive)
- Removedfs.realpath@1.0.0(transitive)
- Removedglob@7.2.3(transitive)
- Removedinflight@1.0.6(transitive)
- Removedinherits@2.0.4(transitive)
- Removedko-sleep@1.1.4(transitive)
- Removedminimatch@3.1.2(transitive)
- Removedmz-modules@2.1.0(transitive)
- Removedonce@1.4.0(transitive)
- Removedpath-is-absolute@1.0.1(transitive)
- Removedpump@3.0.2(transitive)
- Removedrimraf@2.7.1(transitive)
- Removedwrappy@1.0.2(transitive)