AjaxQ icon indicating copy to clipboard operation
AjaxQ copied to clipboard

isRunning always returns true in success function

Open andyburton opened this issue 10 years ago • 7 comments

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.

andyburton avatar Feb 05 '15 16:02 andyburton

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.

thedustinsmith avatar Feb 09 '15 17:02 thedustinsmith

Great thanks for the quick bugfix!

andyburton avatar Feb 10 '15 11:02 andyburton

I just debugged and caught this too. Thanks for fixing it!

samrueby avatar Mar 10 '15 12:03 samrueby

Master branch or v0.0.7 isn't working at the moment, i switched to branch issues/15 to get a working success handler.

TZanke avatar Oct 06 '16 13:10 TZanke

That's weird because there isn't any difference between master and issues/15: https://github.com/Foliotek/AjaxQ/compare/issues/15

thedustinsmith avatar Oct 06 '16 21:10 thedustinsmith

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

TZanke avatar Oct 07 '16 07:10 TZanke

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.

thedustinsmith avatar Oct 11 '16 19:10 thedustinsmith