GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — tools: move message listener to worker objects · nodejs/node@6892536

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • tools
    • jslint.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎tools/jslint.js‎

Copy file name to clipboardExpand all lines: tools/jslint.js
+15-15Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -125,20 +125,6 @@ if (cluster.isMaster) {
125125
sendWork(worker);
126126
});
127127

128-
cluster.on('message', function(worker, results) {
129-
if (typeof results !== 'number') {
130-
// The worker sent us results that are not all successes
131-
if (!workerConfig.sendAll)
132-
failures += results.length;
133-
outFn(formatter(results) + '\r\n');
134-
printProgress();
135-
} else {
136-
successes += results;
137-
}
138-
// Try to give the worker more work to do
139-
sendWork(worker);
140-
});
141-
142128
process.on('exit', function() {
143129
if (showProgress) {
144130
curPath = 'Done';
@@ -149,7 +135,21 @@ if (cluster.isMaster) {
149135
});
150136

151137
for (i = 0; i < numCPUs; ++i)
152-
cluster.fork();
138+
cluster.fork().on('message', onWorkerMessage);
139+
140+
function onWorkerMessage(results) {
141+
if (typeof results !== 'number') {
142+
// The worker sent us results that are not all successes
143+
if (!workerConfig.sendAll)
144+
failures += results.length;
145+
outFn(formatter(results) + '\r\n');
146+
printProgress();
147+
} else {
148+
successes += results;
149+
}
150+
// Try to give the worker more work to do
151+
sendWork(this);
152+
}
153153

154154
function sendWork(worker) {
155155
if (!files || !files.length) {

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.