Skip to content

Commit

Permalink
Fix cancelAll() termination condition
Browse files Browse the repository at this point in the history
The method cancellAll() was using the field maxPreload to determine when the for loop should terminate, which was always off by one compared to the size of the preloadTargetQueue, and therefore, not all the pre-loaded requests would be canceled. This issue was raised in #3693
  • Loading branch information
paynemiller92 committed Aug 27, 2019
1 parent f36a9fa commit 047c22d
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ private void preloadItem(@Nullable T item, int position, int perItemPosition) {
}

private void cancelAll() {
for (int i = 0; i < maxPreload; i++) {
for (int i = 0; i < preloadTargetQueue.queue.size(); i++) {
requestManager.clear(preloadTargetQueue.next(0, 0));
}
}
Expand Down

0 comments on commit 047c22d

Please sign in to comment.