Skip to content

Commit

Permalink
feat: disable cluster-client heartbeat on debug mode (#5059)
Browse files Browse the repository at this point in the history
closes #5057

Co-authored-by: eryi <eryi@gaoding.com>
  • Loading branch information
sinkhaha and eryi committed Nov 14, 2022
1 parent 0e53bfd commit 6de5cba
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions lib/egg.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const path = require('path');
const fs = require('fs');
const ms = require('ms');
const http = require('http');
const inspector = require('inspector');
const EggCore = require('egg-core').EggCore;
const cluster = require('cluster-client');
const extend = require('extend2');
Expand Down Expand Up @@ -113,6 +114,8 @@ class EggApplication extends EggCore {
// agent worker is leader, app workers are follower
isLeader: this.type === 'agent',
logger: this.coreLogger,
// debug mode does not check heartbeat
isCheckHeartbeat: inspector.url() === undefined,
});
const client = cluster(clientClass, options);
this._patchClusterClient(client);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"agentkeepalive": "^4.2.1",
"cache-content-type": "^1.0.1",
"circular-json-for-egg": "^1.0.0",
"cluster-client": "^3.1.1",
"cluster-client": "^3.3.0",
"debug": "^4.3.4",
"delegates": "^1.0.0",
"egg-cluster": "^2.0.0",
Expand Down

0 comments on commit 6de5cba

Please sign in to comment.