Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.5.8

Bug #9020 logical bug in ordered queue code
Submitted: 2006-10-13 22:29 UTC
From: jfillman at cucbc dot com Assigned: auroraeosrose
Status: Closed Package: HTML_AJAX (version 0.5.0)
PHP Version: 4.3.2 OS: RHEL 3
Roadmaps: 0.5.1    
Subscription  


 [2006-10-13 22:29 UTC] jfillman at cucbc dot com (James Fillman)
Description: ------------ I found a bug in the logic of the ordered Queue. If a number of items in the queue come back out of order, the callback function for the last item in the queue never gets called. It's too dificult for me to illustrate the exact senario's that cause the bug but it will occur consistantly if the requests in the queue come back in this order: 1 2 5 4 3 or 1 2 3 5 4 or 1 2 4 3 5 the bug is in the processCallback function in the HTML_AJAX_Queue_Ordered class. here's the original code: processCallback: function(result,order) { if (order == this.current) { this.callbacks[order](result); this.current++; } else { this.interned[order] = result; if (this.interned[this.current]) { this.callbacks[this.current](this.interned[this.current]); this.current++; } } } and here's the new function that seems to be working for me: processCallback: function(result,order) { if (order == this.current) { this.callbacks[order](result); this.current++; } else { this.interned[order] = result; } while (this.interned[this.current]) { this.callbacks[this.current](this.interned[this.current]); this.current++; } }

Comments

 [2006-10-25 18:08 UTC] auroraeosrose (emsmith)
fixed in svn, thanks