Skip to content

Commit

Permalink
Use short form for object properties
Browse files Browse the repository at this point in the history
  • Loading branch information
mcheshkov committed Jun 19, 2018
1 parent 953fac1 commit 2e413eb
Show file tree
Hide file tree
Showing 12 changed files with 24 additions and 23 deletions.
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"no-console": 0,
"no-mixed-requires": 0,
"no-multiple-empty-lines": [2, {"max": 1}],
"object-shorthand": "error",
"no-var": "error",
"global-require": 0,
"prefer-arrow-callback": "error"
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions lib/cluster_process.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ class ClusterProcess extends EventEmitterEx {
const timeouted = extensions.filter(name => !loadedExtensions.has(name)),
error = LusterClusterProcessError.createError(
LusterClusterProcessError.CODES.EXTENSIONS_LOAD_TIMEOUT,
{timeouted: timeouted, timeout: loadTimeout});
{timeouted, timeout: loadTimeout});

self.emit('error', error);
}, loadTimeout);
Expand Down Expand Up @@ -242,7 +242,7 @@ class ClusterProcess extends EventEmitterEx {
if (has(this._remoteCommands, name)) {
throw LusterClusterProcessError.createError(
LusterClusterProcessError.CODES.REMOTE_COMMAND_ALREADY_REGISTERED,
{name: name});
{name});
}

this._remoteCommands[name] = fn;
Expand Down
2 changes: 1 addition & 1 deletion lib/configuration/check.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ function checkProperty(path, value, check) {
LusterConfigurationError.CODES.PROP_TYPE_CHECK_FAILED,
{
property: path,
type: type,
type,
expected: allowedTypes.join(' or ')
});
}
Expand Down
8 changes: 4 additions & 4 deletions lib/configuration/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ function has(context, path) {
}

module.exports = {
typeOf: typeOf,
has: has,
get: get,
set: set,
typeOf,
has,
get,
set,
};
8 changes: 4 additions & 4 deletions lib/master.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,10 +222,10 @@ class Master extends ClusterProcess {
// create pool of workers
while (count > i++) {
this.add(new WorkerWrapper(this, {
forkTimeout: forkTimeout,
stopTimeout: stopTimeout,
exitThreshold: exitThreshold,
allowedSequentialDeaths: allowedSequentialDeaths,
forkTimeout,
stopTimeout,
exitThreshold,
allowedSequentialDeaths,
port: isServerPortSet ? port.next(group) : 0,
maxListeners: this.getMaxListeners(),
}));
Expand Down
2 changes: 1 addition & 1 deletion lib/port.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class Port {
if (this.family !== Port.UNIX) {
cb(LusterPortError
.createError(LusterPortError.CODES.NOT_UNIX_SOCKET)
.bind({value: value}));
.bind({value}));
return;
}

Expand Down
10 changes: 5 additions & 5 deletions lib/rpc-callback.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const RPCCallback = {
* @param {Number} [timeout=10000] in milliseconds
* @returns {String} callbackId
*/
setCallback: function(proc, command, callback, timeout) {
setCallback(proc, command, callback, timeout) {
const storage = this._storage;

if ( ! timeout) {
Expand All @@ -22,14 +22,14 @@ const RPCCallback = {
const callbackId = proc.wid + '_' + this._counter++;

storage[callbackId] = {
callback: callback,
callback,
timeout:
setTimeout(() => {
storage[callbackId].callback(
proc,
LusterRPCCallbackError.createError(
LusterRPCCallbackError.CODES.REMOTE_CALL_WITH_CALLBACK_TIMEOUT,
{ command: command }));
{ command }));
this.removeCallback(callbackId);
}, timeout)
};
Expand All @@ -42,7 +42,7 @@ const RPCCallback = {
* @param {String} callbackId
* @param {*} [data] provided in callback
*/
processCallback: function(proc, callbackId, data) {
processCallback(proc, callbackId, data) {
const stored = this._storage[callbackId];

if ( ! stored) {
Expand All @@ -56,7 +56,7 @@ const RPCCallback = {
/**
* @param {String} callbackId
*/
removeCallback: function(callbackId) {
removeCallback(callbackId) {
const timeout = this._storage[callbackId].timeout;

clearTimeout(timeout);
Expand Down
4 changes: 2 additions & 2 deletions lib/rpc.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const RPC = {
* @param {Object} target must have `send` method
* @returns {Function} (String name, ...args)
*/
createCaller: function(target) {
createCaller(target) {
return function(name, ...args) {
const message = { cmd: 'luster_' + name };

Expand All @@ -28,7 +28,7 @@ const RPC = {
* @param {*} message
* @returns IPCMessage|null IPCMessage if `message` is valid luster IPC message, null – while not
*/
parseMessage: function(message) {
parseMessage(message) {
if (message &&
typeof message.cmd === 'string' &&
message.cmd.indexOf('luster_') === 0) {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion test/func/helpers/luster_instance.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class LusterInstance {
if (typeof(env) === 'boolean') {
pipeStderr = env;
}
const instance = fork(path.resolve(__dirname, name), {env: env, silent: true});
const instance = fork(path.resolve(__dirname, name), {env, silent: true});
const res = new LusterInstance(instance, pipeStderr);

// Promise is resolved when master process replies to ping
Expand Down

0 comments on commit 2e413eb

Please sign in to comment.