Skip to content
This repository

docs: grammar and spelling on lib/cluster.js #3049

Closed
wants to merge 3 commits into from

3 participants

Zachary Scott Ben Noordhuis Shannen Saez
Zachary Scott
zzak commented

No description provided.

Shannen Saez

should beEmit listening

Shannen Saez

should be and then disconnect

Shannen Saez

something like The suicide state has already been set, but it doesn't really matter if we set it again.

Shannen Saez

from _the_ parent perhaps?

lib/cluster.js
((6 lines not shown))
192 192
   messageHandler.queryServer = function(message, worker, send) {
193 193
 
194  
-    // This sequence of infomation is unique to the connection but not
195  
-    // to the worker
  194
+    // This sequence of infomation is unique to the connection 
3
Ben Noordhuis
bnoordhuis added a note

infomation?

Zachary Scott
zzak added a note

Thanks, merged in zzak/node@08fa918

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Zachary Scott zzak referenced this pull request in zzak/node
Closed

More spelling & grammar. #1

Ben Noordhuis

Thanks Zachary, merged in d73b257.

Ben Noordhuis bnoordhuis closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 30 additions and 30 deletions. Show diff stats Hide diff stats

  1. 60  lib/cluster.js
60  lib/cluster.js
@@ -61,15 +61,15 @@ cluster.isMaster = ! cluster.isWorker;
61 61
 
62 62
 // The worker object is only used in a worker
63 63
 cluster.worker = cluster.isWorker ? {} : null;
64  
-// The workers array is oly used in the naster
  64
+// The workers array is only used in the master
65 65
 cluster.workers = cluster.isMaster ? {} : null;
66 66
 
67 67
 // Settings object
68 68
 var settings = cluster.settings = {};
69 69
 
70  
-// Simple function there call a function on each worker
  70
+// Simple function to call a function on each worker
71 71
 function eachWorker(cb) {
72  
-  // Go througe all workers
  72
+  // Go through all workers
73 73
   for (var id in cluster.workers) {
74 74
     if (cluster.workers.hasOwnProperty(id)) {
75 75
       cb(cluster.workers[id]);
@@ -94,7 +94,7 @@ cluster.setupMaster = function(options) {
94 94
   // This can only be called from the master.
95 95
   assert(cluster.isMaster);
96 96
 
97  
-  // Don't allow this function to run more that once
  97
+  // Don't allow this function to run more than once
98 98
   if (masterStarted) return;
99 99
   masterStarted = true;
100 100
 
@@ -121,7 +121,7 @@ function isInternalMessage(message) {
121 121
           message.cmd.indexOf(INTERNAL_PREFIX) === 0);
122 122
 }
123 123
 
124  
-// Modyfi message object to be internal
  124
+// Modify message object to be internal
125 125
 function internalMessage(inMessage) {
126 126
   var outMessage = util._extend({}, inMessage);
127 127
 
@@ -131,10 +131,10 @@ function internalMessage(inMessage) {
131 131
   return outMessage;
132 132
 }
133 133
 
134  
-// Handle callback messges
  134
+// Handle callback messages
135 135
 function handleResponse(outMessage, outHandle, inMessage, inHandle, worker) {
136 136
 
137  
-  // The message there will be send
  137
+  // The message there will be sent
138 138
   var message = internalMessage(outMessage);
139 139
 
140 140
   // callback id - will be undefined if not set
@@ -146,7 +146,7 @@ function handleResponse(outMessage, outHandle, inMessage, inHandle, worker) {
146 146
     delete queryCallbacks[inMessage._queryEcho];
147 147
   }
148 148
 
149  
-  // Send if outWrap do contain something useful
  149
+  // Send if outWrap contains something useful
150 150
   if (!(outMessage === undefined && message._queryEcho === undefined)) {
151 151
     sendInternalMessage(worker, message, outHandle);
152 152
   }
@@ -156,7 +156,7 @@ function handleResponse(outMessage, outHandle, inMessage, inHandle, worker) {
156 156
 var messageHandler = {};
157 157
 function handleMessage(worker, inMessage, inHandle) {
158 158
 
159  
-  //Remove internal prefix
  159
+  // Remove internal prefix
160 160
   var message = util._extend({}, inMessage);
161 161
   message.cmd = inMessage.cmd.substr(INTERNAL_PREFIX.length);
162 162
 
@@ -166,18 +166,18 @@ function handleMessage(worker, inMessage, inHandle) {
166 166
     handleResponse(outMessage, outHandler, inMessage, inHandle, worker);
167 167
   }
168 168
 
169  
-  // Run handler if it exist
  169
+  // Run handler if it exists
170 170
   if (messageHandler[message.cmd]) {
171 171
     messageHandler[message.cmd](message, worker, respond);
172 172
   }
173 173
 
174  
-  // Send respond if it wasn't done
  174
+  // Send respond if it hasn't been called yet
175 175
   if (respondUsed === false) {
176 176
     respond();
177 177
   }
178 178
 }
179 179
 
180  
-// Messages to the master will be handled using this methods
  180
+// Messages to the master will be handled using these methods
181 181
 if (cluster.isMaster) {
182 182
 
183 183
   // Handle online messages from workers
@@ -188,11 +188,11 @@ if (cluster.isMaster) {
188 188
     cluster.emit('online', worker);
189 189
   };
190 190
 
191  
-  // Handle queryServer messages form workers
  191
+  // Handle queryServer messages from workers
192 192
   messageHandler.queryServer = function(message, worker, send) {
193 193
 
194  
-    // This sequence of infomation is unique to the connection but not
195  
-    // to the worker
  194
+    // This sequence of information is unique to the connection
  195
+    // but not to the worker
196 196
     var args = [message.address, message.port, message.addressType];
197 197
     var key = args.join(':');
198 198
     var handler;
@@ -212,7 +212,7 @@ if (cluster.isMaster) {
212 212
 
213 213
     worker.state = 'listening';
214 214
 
215  
-    // Emit listining, now that we know the worker is listning
  215
+    // Emit listening, now that we know the worker is listening
216 216
     worker.emit('listening', worker, {
217 217
       address: message.address,
218 218
       port: message.port,
@@ -232,7 +232,7 @@ if (cluster.isMaster) {
232 232
 
233 233
 }
234 234
 
235  
-// Messages to a worker will be handled using this methods
  235
+// Messages to a worker will be handled using these methods
236 236
 else if (cluster.isWorker) {
237 237
 
238 238
   // Handle worker.disconnect from master
@@ -246,7 +246,7 @@ function toDecInt(value) {
246 246
   return isNaN(value) ? null : value;
247 247
 }
248 248
 
249  
-// Create a worker object, there works both for master and worker
  249
+// Create a worker object, that works both for master and worker
250 250
 function Worker(customEnv) {
251 251
   if (!(this instanceof Worker)) return new Worker();
252 252
 
@@ -353,7 +353,7 @@ function sendInternalMessage(worker, message/*, handler, callback*/) {
353 353
 // Send message to worker or master
354 354
 Worker.prototype.send = function() {
355 355
 
356  
-  //You could also just use process.send in a worker
  356
+  // You could also just use process.send in a worker
357 357
   this.process.send.apply(this.process, arguments);
358 358
 };
359 359
 
@@ -379,7 +379,7 @@ Worker.prototype.destroy = function() {
379 379
     // Channel is open
380 380
     if (this.process.connected) {
381 381
 
382  
-      // Inform master that is is suicide and then kill
  382
+      // Inform master to suicide and then kill
383 383
       sendInternalMessage(this, {cmd: 'suicide'}, function() {
384 384
         process.exit(0);
385 385
       });
@@ -394,8 +394,8 @@ Worker.prototype.destroy = function() {
394 394
   }
395 395
 };
396 396
 
397  
-// The .disconnect function will close all server and then disconnect
398  
-// the IPC channel.
  397
+// The .disconnect function will close all servers
  398
+// and then disconnect the IPC channel.
399 399
 if (cluster.isMaster) {
400 400
   // Used in master
401 401
   Worker.prototype.disconnect = function() {
@@ -414,7 +414,7 @@ if (cluster.isMaster) {
414 414
     // keep track of open servers
415 415
     var servers = Object.keys(serverListeners).length;
416 416
     var progress = new ProgressTracker(servers, function() {
417  
-      // there are no more servers open so we will close the IPC channel.
  417
+      // There are no more servers open so we will close the IPC channel.
418 418
       // Closing the IPC channel will emit a disconnect event
419 419
       // in both master and worker on the process object.
420 420
       // This event will be handled by prepareExit.
@@ -422,8 +422,8 @@ if (cluster.isMaster) {
422 422
     });
423 423
 
424 424
     // depending on where this function was called from (master or worker)
425  
-    // the suicide state has allready been set.
426  
-    // But it dosn't really matter if we set it again.
  425
+    // The suicide state has already been set,
  426
+    // but it doesn't really matter if we set it again.
427 427
     sendInternalMessage(this, {cmd: 'suicide'}, function() {
428 428
       // in case there are no servers
429 429
       progress.check();
@@ -433,7 +433,7 @@ if (cluster.isMaster) {
433 433
       for (var key in serverListeners) {
434 434
         server = serverListeners[key];
435 435
 
436  
-        // in case the server is closed we wont close it again
  436
+        // in case the server is closed we won't close it again
437 437
         if (server._handle === null) {
438 438
           progress.done();
439 439
           continue;
@@ -452,7 +452,7 @@ cluster.fork = function(env) {
452 452
   // This can only be called from the master.
453 453
   assert(cluster.isMaster);
454 454
 
455  
-  // Make sure that the master has been initalized
  455
+  // Make sure that the master has been initialized
456 456
   cluster.setupMaster();
457 457
 
458 458
   return (new cluster.Worker(env));
@@ -481,7 +481,7 @@ cluster.disconnect = function(callback) {
481 481
     worker.disconnect();
482 482
   });
483 483
 
484  
-  // in case there wasn't any workers
  484
+  // in case there weren't any workers
485 485
   progress.check();
486 486
 };
487 487
 
@@ -491,8 +491,8 @@ cluster._setupWorker = function() {
491 491
   // Get worker class
492 492
   var worker = cluster.worker = new Worker();
493 493
 
494  
-  // when the worker is disconnected from parent accidentally
495 494
   // we will terminate the worker
  495
+  // when the worker is disconnected from the parent accidentally
496 496
   process.once('disconnect', function() {
497 497
     if (worker.suicide !== true) {
498 498
       process.exit(0);
@@ -532,7 +532,7 @@ cluster._getServer = function(tcpSelf, address, port, addressType, cb) {
532 532
     addressType: addressType
533 533
   };
534 534
 
535  
-  // The callback will be stored until the master has responed
  535
+  // The callback will be stored until the master has responded
536 536
   sendInternalMessage(cluster.worker, message, function(msg, handle) {
537 537
     cb(handle);
538 538
   });
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.