FredrikSandell / angular-workers

MIT License
69 stars 25 forks source link

Concurrency problem #10

Open joaofernandes opened 8 years ago

joaofernandes commented 8 years ago

Hi, I'm currently trying to re-use the angular-worker and I already managed to only execute the Run function once the angularWorker is finally available, the problem is, when multiple executions run concurrently, the response from the worker get mixed up. I'm currently only returning a $http request from the worker

return $http({ method: input.method, url: input.url, data: input.data, headers: input.headers, config: input.config }).then(function (result) { output.resolve(JSON.parse(JSON.stringify(result))); }, function (fail) { return output.reject(fail); });

When running the same code but always creating a new worker, it works like a charm since there is no possible way to 1 request get mixed up with another worker job.