0

Iam making a Worker Thread start , in this thread I make an Ajax call to get data and on worker receive message i bind data to grid.

NOTE ; I have 10 grids and whenever I change context(grid changes) and I call worker thread to get data and bind to grid.

everything works fine for a certain amount and suddenly worker thread stops posting messaes to my script.Iam not able to get whats happening.

Im also killing worker thread based on my logic.

Please find attached screenshot to see the pattern of how iam making worker calls and how iam getting response from worker thread.

Im not able to attach image here,hence sharing link

http://img834.imageshack.us/img834/7300/dwwu.jpg

Help appreciated.

Sunil Vurity
  • 830
  • 9
  • 14
  • Please post the code for the worker. It would be much more useful for debugging than a screenshot. – idbehold Dec 26 '13 at 23:57
  • @idbehold From Main thread, var worker = new Worker('scripts/app/smartdataloading.js'); for(...4 times ) { worker.postMessage(....); } worker.onmessage = function (event) { if(no.ofreq == no.Of response) worker.terminate(); --worker code ( smartdataloading.js)-- var xhr = new XMLHttpRequest();xhr.open('GET', apiPath, true);xhr.setRequestHeader("jwtauth", jwtToken); xhr.onreadystatechange = function () { if (xhr.readyState == 4) { if (xhr.status == 200) { callback(requestContext, isRelatedListCount, JSON.parse(xhr.responseText)); }else {callback(null,null,null);} }xhr.send(null); – Sunil Vurity Dec 30 '13 at 21:37
  • I am assuming that the whole process is getting into some race condition – Sunil Vurity Dec 31 '13 at 00:27
  • Not sure it will solve anything, but there's no need to make an XHR synchronous inside a `Worker` as it's already running inside another thread. – idbehold Dec 31 '13 at 04:35

0 Answers0