AjaxQ
AjaxQ copied to clipboard
isRunning always returns true in success function
The isRunning methods checks to see if the queue exists which it always does in the ajax success function because the request isn't removed from the queue until the dequeue function is called AFTER all the deferred done/fail functions are applied (as explicitly defined on line 41) - which is in complete contrast to the example provided in the documentation.
Thanks for the input. I originally moved the dequeue to be after the callbacks due to a request to modify some data before dequeuing the next request. Unfortunately, I didn't check the isRunning functionality (One of these days we'll set up some tests).
I've created a branch with a fix to this issue (696736054ffa0a6544b77686cf05751a2f995a2a). I'm going to keep it in that branch for a bit, to play around with it. Feel free to see if it fixes your issues. Now, at least, the example in the documentation is correct.
Great thanks for the quick bugfix!
I just debugged and caught this too. Thanks for fixing it!
Master branch or v0.0.7 isn't working at the moment, i switched to branch issues/15 to get a working success handler.
That's weird because there isn't any difference between master and issues/15: https://github.com/Foliotek/AjaxQ/compare/issues/15
substitute both branches: https://github.com/Foliotek/AjaxQ/compare/issues/15...master
obviously there is a new bug introduced in one of the newer master commits?
https://github.com/Foliotek/AjaxQ/compare/issues/15...master#diff-8cfcbb796749e8359519edc5b99556c3L101
Good call - I can't remember why I made this change:
return (queues.hasOwnProperty(qname) && queues[qname].length > 0) || activeReqs.hasOwnProperty(qname);
Looking at the commit, I'd guess that something in the tests made me do it, but it's been so long at this point I can't remember why.