NO-ob / LoliSnatcher_Droid

A booru client with support for batch downloading
GNU Affero General Public License v3.0
371 stars 23 forks source link

Gallery prefetch 4 resets to 1 everytime browsing a prefetched video #193

Open orariley70 opened 1 year ago

orariley70 commented 1 year ago

Reproduction steps: Video cache mode: Cache Gallery preview: 4 Consider this gallery view, with each letter representing 1 booru media, those in brackets have already been cached to disk: A and B are videos, everything else are pictures. A[B]CDEF[G] I start viewing media G:

A[B]CDEF[G]
         ^

Scroll to media F, which is uncached. App starts downloading in foreground:

A[B]CDEF[G]
       ^

Scroll towards media C, which is uncached. App starts downloading C, continues downloading DEF in background (---):

A[B]CDEF[G]
    ^---

Now I scroll to media B, which is a precached video. At this point, the app suddenly reset the Gallery preview: 4 to Gallery preview: 1, stopping download DEF, but keeps downloading C (-):

A[B]CDEF[G]
  ^-

Finally, I scroll to media A, which is an uncached video. At this point, app will stop downloading media C, because media A needs to be cached, and Gallery preview: 1 will remove job C.

A[B]CDEF[G]
^

Expected: App continues downloading uncached media no matter which media I am watching now, correctly removing jobs that has the oldest start time

Result: App resets Gallery preview to 1, then drops any other caching job when it starts downloading current foreground uncached media