troika-worker-utils
Advanced tools
Comparing version 0.38.0 to 0.38.1
@@ -6,2 +6,13 @@ # Change Log | ||
## [0.38.1](https://github.com/protectwise/troika/compare/v0.38.0...v0.38.1) (2021-02-03) | ||
### Bug Fixes | ||
* **troika-worker-utils:** properly track open requests count ([a01d903](https://github.com/protectwise/troika/commit/a01d903245eee3b9798bcfac7397108fb3bb03e7)) | ||
# [0.38.0](https://github.com/protectwise/troika/compare/v0.37.0...v0.38.0) (2021-01-24) | ||
@@ -8,0 +19,0 @@ |
@@ -578,3 +578,3 @@ /** | ||
delete openRequests[msgId]; | ||
openRequests.count--; | ||
openRequests._count--; | ||
callback(response); | ||
@@ -598,3 +598,3 @@ }; | ||
openRequests._count++; | ||
if (openRequests.count > 1000) { //detect leaks | ||
if (openRequests._count > 1000) { //detect leaks | ||
console.warn('Large number of open WorkerModule requests, some may not be returning'); | ||
@@ -601,0 +601,0 @@ } |
@@ -584,3 +584,3 @@ (function (global, factory) { | ||
delete openRequests[msgId]; | ||
openRequests.count--; | ||
openRequests._count--; | ||
callback(response); | ||
@@ -604,3 +604,3 @@ }; | ||
openRequests._count++; | ||
if (openRequests.count > 1000) { //detect leaks | ||
if (openRequests._count > 1000) { //detect leaks | ||
console.warn('Large number of open WorkerModule requests, some may not be returning'); | ||
@@ -607,0 +607,0 @@ } |
@@ -10,5 +10,5 @@ 'use strict';(function(m,r){"object"===typeof exports&&"undefined"!==typeof module?r(exports):"function"===typeof define&&define.amd?define(["exports"],r):(m=m||self,r(m.troika_worker_utils={}))})(this,function(m){function r(){function b(f,c){n++;var v=0;try{c===q&&g();var u=0<f&&e(c);u?u.call(c,a(function(a){v++;b(1,a)}),a(function(a){v++;b(-1,a)})):(l=f,k=c,h||(setTimeout(d,0),h=1))}catch(D){l||v||b(-1,D)}}function d(){var a=f;h=0;f=[];a.forEach(c)}function c(a){a()}function e(a){a=a&&(p(a)||"object"=== | ||
g=b.workerId;if(!B())return G(b);null==g&&(g="#default");var l="workerModule"+ ++H,f=b.name||l,k=null;c=c&&c.map(function(a){"function"!==typeof a||a.workerModuleData||(x=!0,a=w({workerId:g,name:"<"+f+"> function dependency: "+a.name,init:"function(){return (\n"+t(a)+"\n)}"}),x=!1);a&&a.workerModuleData&&(a=a.workerModuleData);return a});d.workerModuleData={isWorkerModule:!0,id:l,name:f,dependencies:c,init:t(e),getTransferables:a&&t(a)};return d}function t(b){b=b.toString();!/^function/.test(b)&& | ||
/^\w+\s*\(/.test(b)&&(b="function "+b);return b}function I(b){var d=C[b];d||(d=t(F),d=C[b]=new Worker(URL.createObjectURL(new Blob(["/** Worker Module Bootstrap: "+b.replace(/\*/g,"")+" **/\n\n;("+d+")()"],{type:"application/javascript"}))),d.onmessage=function(b){b=b.data;var c=b.messageId,a=q[c];if(!a)throw Error("WorkerModule response with empty or unknown messageId");delete q[c];q.count--;a(b)});return d}function A(b,d,c){var e=p(),a=++J;q[a]=function(a){a.success?e.resolve(a.result):e.reject(Error("Error in worker "+ | ||
d+" call: "+a.error))};q._count++;1E3<q.count&&console.warn("Large number of open WorkerModule requests, some may not be returning");I(b).postMessage({messageId:a,action:d,data:c});return e}r.all=z.all=function(b){var d=0,c=[],e=p();0===b.length?e.resolve([]):b.forEach(function(a,g){var l=p();l.resolve(a);l.then(function(a){d++;c[g]=a;d===b.length&&e.resolve(c)},e.reject)});return e};var p="function"===typeof Promise?z:r,B=function(){var b=!1;if("undefined"!==typeof window&&"undefined"!==typeof window.document)try{(new Worker(URL.createObjectURL(new Blob([""], | ||
/^\w+\s*\(/.test(b)&&(b="function "+b);return b}function I(b){var d=C[b];d||(d=t(F),d=C[b]=new Worker(URL.createObjectURL(new Blob(["/** Worker Module Bootstrap: "+b.replace(/\*/g,"")+" **/\n\n;("+d+")()"],{type:"application/javascript"}))),d.onmessage=function(b){b=b.data;var c=b.messageId,a=q[c];if(!a)throw Error("WorkerModule response with empty or unknown messageId");delete q[c];q._count--;a(b)});return d}function A(b,d,c){var e=p(),a=++J;q[a]=function(a){a.success?e.resolve(a.result):e.reject(Error("Error in worker "+ | ||
d+" call: "+a.error))};q._count++;1E3<q._count&&console.warn("Large number of open WorkerModule requests, some may not be returning");I(b).postMessage({messageId:a,action:d,data:c});return e}r.all=z.all=function(b){var d=0,c=[],e=p();0===b.length?e.resolve([]):b.forEach(function(a,g){var l=p();l.resolve(a);l.then(function(a){d++;c[g]=a;d===b.length&&e.resolve(c)},e.reject)});return e};var p="function"===typeof Promise?z:r,B=function(){var b=!1;if("undefined"!==typeof window&&"undefined"!==typeof window.document)try{(new Worker(URL.createObjectURL(new Blob([""], | ||
{type:"application/javascript"})))).terminate(),b=!0}catch(d){"undefined"!==typeof process&&"test"===process.env.NODE_ENV||console.log("Troika createWorkerModule: web workers not allowed; falling back to main thread execution. Cause: ["+d.message+"]")}B=function(){return b};return b},H=0,J=0,x=!1,C=Object.create(null),q=function(){var b=Object.create(null);b._count=0;return b}(),K=w({name:"Thenable",dependencies:[p],init:function(b){return b}});m.Thenable=p;m.ThenableWorkerModule=K;m.defineWorkerModule= | ||
w;m.stringifyFunction=t;Object.defineProperty(m,"__esModule",{value:!0})}) |
{ | ||
"name": "troika-worker-utils", | ||
"version": "0.38.0", | ||
"version": "0.38.1", | ||
"description": "Utilities for executing code in Web Workers", | ||
@@ -16,3 +16,3 @@ "author": "Jason Johnston <jason.johnston@protectwise.com>", | ||
"module:src": "src/index.js", | ||
"gitHead": "d48144bf99a2eaf2089c0cd2a8065506161dfdf4" | ||
"gitHead": "b54fd6f27b4d95190747ff94cf4e101239447fea" | ||
} |
@@ -149,3 +149,3 @@ import Thenable from './Thenable.js' | ||
delete openRequests[msgId] | ||
openRequests.count-- | ||
openRequests._count-- | ||
callback(response) | ||
@@ -169,3 +169,3 @@ } | ||
openRequests._count++ | ||
if (openRequests.count > 1000) { //detect leaks | ||
if (openRequests._count > 1000) { //detect leaks | ||
console.warn('Large number of open WorkerModule requests, some may not be returning') | ||
@@ -172,0 +172,0 @@ } |
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
88912