catiline icon indicating copy to clipboard operation
catiline copied to clipboard

spotty promise resolution in IE9

Open calvinmetcalf opened this issue 10 years ago • 17 comments

breaking the non-script import part of #66 into it's own issue, basically this

  testWorker = cw (input, callback) ->
    console.log 'i am the worker ',input
    callback input+5

  testWorker.data(2).then (res) -> console.log res

  setTimeout ->
    testWorker.data(3).then (res) -> console.log res
  , 1000

  # Listen for socket event and update the
  # scope with the new data as processed by the above function
  $socket.on 'dataProcessingTrend', (theThing) ->  
    console.log 'chart update recieved'
    testWorker.data(4).then (res) -> console.log res

produces

   i am the worker 2 
   7 
   i am the worker 3 
   8 
   chart update recieved 
   i am the worker 4 
   chart update recieved 
   i am the worker 4 

@Fresheyeball what happends when you add a second callback to the worker inside the socket, ie

success = (data)->
   console.log 'yes ', data
failure = (data)->
    console.log 'no ', data
testWorker.data(4).then success,failure

calvinmetcalf avatar Jul 10 '13 11:07 calvinmetcalf

Ok, so I implemented the success and failure methods exactly as you have them and received the following in my console:

    i am the worker 2 
    yes 7 
    i am the worker 3 
    yes 8 
    chart update recieved 
    i am the worker 4 
    chart update recieved 
    i am the worker 4 
    chart update recieved 
    i am the worker 4 
    chart update recieved 
    i am the worker 4 

Looks like failure never fires either. Very odd.

Fresheyeball avatar Jul 10 '13 17:07 Fresheyeball

Also thank you so much for your help. Communist is proving to be an excellent lib and I am here to help as much as I can.

Fresheyeball avatar Jul 10 '13 17:07 Fresheyeball

if your able to post a jsfiddle that illustrates the error that would be helpful , and thanks for helping bug test it

calvinmetcalf avatar Jul 10 '13 18:07 calvinmetcalf

I will get that too you as soon as I can. Part to the issue there is that I am having trouble reproducing the problem. You will notice the setTimeout in my testcase, I am not sure what is unique about my event handler that screws up the promise. Once I have that figured out I can provide you a much better fiddle.

Fresheyeball avatar Jul 10 '13 18:07 Fresheyeball

Actually if you have any ideas about what might be unique about the southmost function in my testcase that could mess up the promise it would be very helpful.

Fresheyeball avatar Jul 10 '13 18:07 Fresheyeball

that's why I was asking about the fiddle I was curious about what that function is from, angular?

calvinmetcalf avatar Jul 10 '13 18:07 calvinmetcalf

so if I had to guess this would have to do with some of the ie9 stuff resolving synchronously instead of async so try this again it may have been fixed. Also now you can use console.log inside a worker.

calvinmetcalf avatar Jul 18 '13 01:07 calvinmetcalf

Will give it a shot tomorrow. Thanks for providing excellent support :)

Fresheyeball avatar Jul 18 '13 02:07 Fresheyeball

Sorry I have not gotten a chance to test yet. I will ASAP. please stand by.

Fresheyeball avatar Jul 19 '13 15:07 Fresheyeball

Ok, I've tested it. Promise is still not getting resolved in IE9.

Fresheyeball avatar Jul 31 '13 19:07 Fresheyeball

Ok so I need a fiddle from you then that reproduces it

calvinmetcalf avatar Jul 31 '13 19:07 calvinmetcalf

I'm working on it. Been swamped.

Fresheyeball avatar Jul 31 '13 20:07 Fresheyeball

also fyi #97 should in theory help with this (though it depends on the actual problem)

calvinmetcalf avatar Aug 01 '13 09:08 calvinmetcalf

@Fresheyeball this still a problem?

calvinmetcalf avatar Oct 25 '13 18:10 calvinmetcalf

@calvinmetcalf I don't know. I could not get past it and had to purge web workers for the time being. Additionally, and far less helpfully, I was unable to make the problem reproducible.

Fresheyeball avatar Oct 26 '13 07:10 Fresheyeball

damn that's double bad, I'm going to clone this issue for now, if you (or anyone else) is able to reproduce it I can open it back up.

calvinmetcalf avatar Oct 26 '13 12:10 calvinmetcalf

Sounds good. Pretty lame overall

Fresheyeball avatar Oct 28 '13 00:10 Fresheyeball