Nuke: nk_cancelLoading() seems not working thoroughly when scrolling fast in a table view

Let’s say I have a table view with 1000 cells where each cell downloads one image in willDisplayCell:

cell.image.nk_setImageWith(...)

and each row cancels image in didEndDisplayingCell:

cell.image.nk_cancelLoading()

It works pretty well except the case when I scroll very fast (as fast as I can).

Why do I say nk_cancelLoading not working “thoroughly”?

  • NOT Working -> When I scroll fast, say from row 1 to row 500, and I stop at row 500, the cells around row 500 shows no image until 10-20 seconds (seems waiting for something to be finished).
  • Working -> After I see the images for the rows around row 500, and if I scroll back, I see no images are downloaded for earlier rows (when I scroll back, images are shown in a second, which is normal if I scroll normally), which means “cancelling” is working. The images that had been cancelled wasn’t downloaded.

So for the not-working case, I guess somehow, the network requests still jammed in the lower level? Or why would it take so long to show the images. If previous image requests are all cancelled without blocking current requests, the images should shown within one or two seconds as usual.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 21 (12 by maintainers)

Most upvoted comments

Nuke 4 now features a Rate Limiter which solves this problem without any compromises ⚡