Suwayomi / Suwayomi-WebUI

Mozilla Public License 2.0
119 stars 50 forks source link

[Bug] Certain reading modes will try to load all pages #623

Closed Secozzi closed 8 months ago

Secozzi commented 8 months ago

Device information

Steps to reproduce

  1. Set reader type to either double page, webtoon, continuous vertical, or horizontal
  2. Click on a chapter

Expected behavior

Just like single page, only the current page should load. For double page for example, at most one more page should be loaded.

Actual behavior

Tachidesk will try to load all of the pages. This is a problem for servers that can't handle the load. If the chapter contains hundreds of pages, stuff like rate-limiting in the extension may not help. It will also continue to load all of the pages even after exiting the reader.

schroda commented 8 months ago

I wouldn't say that the problem is that all pages are getting requested - which should be the default behaviour, so that it doesn't take forever to load pages for slow sources - but that the requests aren't getting aborted once they are not needed anymore.

Secozzi commented 8 months ago

Is it really a good idea to load the entire list though? For some entries, that may involve loading hundreds of pages. Single page appears to load 0 pages ahead, and every other type loads the rest of the list ahead. Maybe loading a set number of pages ahead, appears to be 4-5 in tachiyomi/mihon, would be a better idea?

schroda commented 8 months ago

the browser only does ~6 requests to the same origin in parallel, the rest of the requests are pending, so the server doesn't know that the client is currently trying to load more than 6 pages

the problem is that on client side these pending requests aren't getting aborted, thus, they're blocking all future requests so aborting them once the reader gets closed or the chapter changes will prevent this issue

not preloading the pages will just result in a poor experience for slow sources as can already be seen with the single page mode for uncached and not downloaded chapters

however, the overall page request logic is something that can be improved in the future but for now aborting the requests is the easier fix and is something that should happen regardless of if pages are getting preloaded or not