Skip to content

Commit b393ca2

Browse files
committed
SCWorkerCluster also needs to support create shortcut method
1 parent 2da3965 commit b393ca2

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

scworkercluster.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,23 @@ process.on('uncaughtException', function (err) {
8383
process.exit(1);
8484
});
8585

86-
function SCWorkerCluster() {
86+
function SCWorkerCluster(options) {
8787
if (scWorkerCluster) {
8888
// SCWorkerCluster is a singleton; it can only be instantiated once per process.
8989
throw new InvalidActionError('Attempted to instantiate a worker cluster which has already been instantiated');
9090
}
91+
options = options || {};
9192
scWorkerCluster = this;
9293

94+
if (options.run != null) {
95+
this.run = options.run;
96+
}
97+
9398
this._init(workerInitOptions);
99+
}
100+
101+
SCWorkerCluster.create = function (options) {
102+
return new SCWorkerCluster(options);
94103
};
95104

96105
SCWorkerCluster.prototype._init = function (options) {

0 commit comments

Comments
 (0)