| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent d81b9af commit e9028eb
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -100,10 +100,13 @@ cluster._getServer = function(obj, options, cb) { | |||
| 100 | 100 | if (typeof obj._setServerData === 'function') | |
| 101 | 101 | obj._setServerData(reply.data); | |
| 102 | 102 | ||
| 103 | - if (handle) | ||
| 104 | - shared(reply, handle, indexesKey, index, cb); // Shared listen socket. | ||
| 105 | - else | ||
| 106 | - rr(reply, indexesKey, index, cb); // Round-robin. | ||
| 103 | + if (handle) { | ||
| 104 | + // Shared listen socket | ||
| 105 | + shared(reply, { handle, indexesKey, index }, cb); | ||
| 106 | + } else { | ||
| 107 | + // Round-robin. | ||
| 108 | + rr(reply, { indexesKey, index }, cb); | ||
| 109 | + } | ||
| 107 | 110 | }); | |
| 108 | 111 | ||
| 109 | 112 | obj.once('listening', () => { | |
@@ -128,7 +131,7 @@ function removeIndexesKey(indexesKey, index) { | |||
| 128 | 131 | } | |
| 129 | 132 | ||
| 130 | 133 | // Shared listen socket. | |
| 131 | - function shared(message, handle, indexesKey, index, cb) { | ||
| 134 | + function shared(message, { handle, indexesKey, index }, cb) { | ||
| 132 | 135 | const key = message.key; | |
| 133 | 136 | // Monkey-patch the close() method so we can keep track of when it's | |
| 134 | 137 | // closed. Avoids resource leaks when the handle is short-lived. | |
@@ -145,8 +148,8 @@ function shared(message, handle, indexesKey, index, cb) { | |||
| 145 | 148 | cb(message.errno, handle); | |
| 146 | 149 | } | |
| 147 | 150 | ||
| 148 | - // Round-robin. Primary distributes handles across workers. | ||
| 149 | - function rr(message, indexesKey, index, cb) { | ||
| 151 | + // Round-robin. Master distributes handles across workers. | ||
| 152 | + function rr(message, { indexesKey, index }, cb) { | ||
| 150 | 153 | if (message.errno) | |
| 151 | 154 | return cb(message.errno, null); | |
| 152 | 155 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments