BulkLoader
BulkLoader copied to clipboard
Removing an item in the complete handler can stall BulkLoader
If, in the onComplete handler of an item, you call remove() on it, BulkLoader can stall. It comes from _onItemComplete being added using int.MIN_VALUE:
item.addEventListener(Event.COMPLETE, _onItemComplete, false, int.MIN_VALUE, true);
To fix it, either set the priority to int.MAX_VALUE, or update the remove() function to include:
if(allDone) {
_onAllLoaded();
}
else if ( !_isPaused )
{
// this needs to try to load a next item, because this might get called inside a
// complete handler and if it's on the last item on the open connections, it might stale
_loadNext();
}
I'm more for the latter solution, as it's already used in a number of places in the file to combat the same problem