jest-worker
Advanced tools
Comparing version 23.0.0-alpha.7 to 23.0.0-alpha.3r
@@ -176,2 +176,3 @@ /** | ||
[(_types || _load_types()).CHILD_MESSAGE_END, false], | ||
emptyMethod, | ||
emptyMethod | ||
@@ -223,7 +224,9 @@ ); | ||
// the worker that executed the call. | ||
function callback(error, result) { | ||
const onProcessStart = worker => { | ||
if (hash != null) { | ||
cacheKeys[hash] = this; | ||
cacheKeys[hash] = worker; | ||
} | ||
}; | ||
const onProcessEnd = (error, result) => { | ||
if (error) { | ||
@@ -234,7 +237,7 @@ reject(error); | ||
} | ||
} | ||
}; | ||
// If a worker is pre-selected, use it... | ||
if (worker) { | ||
worker.send(request, callback); | ||
worker.send(request, onProcessStart, onProcessEnd); | ||
return; | ||
@@ -245,3 +248,7 @@ } | ||
for (let i = 0; i < length; i++) { | ||
workers[(i + this._offset) % length].send(request, callback); | ||
workers[(i + this._offset) % length].send( | ||
request, | ||
onProcessStart, | ||
onProcessEnd | ||
); | ||
} | ||
@@ -248,0 +255,0 @@ |
@@ -66,4 +66,4 @@ /** | ||
send(request, callback) { | ||
const item = {callback, next: null, request}; | ||
send(request, onProcessStart, onProcessEnd) { | ||
const item = {next: null, onProcessEnd, onProcessStart, request}; | ||
@@ -148,2 +148,5 @@ if (this._last) { | ||
// Tell the parent that this item is starting to be processed. | ||
item.onProcessStart(this); | ||
this._retries = 0; | ||
@@ -166,3 +169,3 @@ this._busy = true; | ||
const callback = item.callback; | ||
const onProcessEnd = item.onProcessEnd; | ||
@@ -174,3 +177,3 @@ this._busy = false; | ||
case (_types || _load_types()).PARENT_MESSAGE_OK: | ||
callback.call(this, null, response[1]); | ||
onProcessEnd(null, response[1]); | ||
break; | ||
@@ -197,3 +200,3 @@ | ||
callback.call(this, error, null); | ||
onProcessEnd(error, null); | ||
break; | ||
@@ -200,0 +203,0 @@ |
{ | ||
"name": "jest-worker", | ||
"version": "23.0.0-alpha.7", | ||
"version": "23.0.0-alpha.3r", | ||
"repository": { | ||
@@ -5,0 +5,0 @@ "type": "git", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
23438
488