BulkLoader icon indicating copy to clipboard operation
BulkLoader copied to clipboard

Removing an item in the complete handler can stall BulkLoader

Open divillysausages opened this issue 11 years ago • 0 comments

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

divillysausages avatar Mar 07 '14 17:03 divillysausages