Repository navigation
Fix QuerySet slicing logic - #1047
Conversation
fd17ecc to
ec70791
Compare
|
looks good, I know I've made it a little ugly with the rebasing. Is it possible to write a test that shows this fix? What kind of sizes were you seeing the crash at? |
|
(I will fix the conflicts/merge it, don't worry about those) |
edaac6b to
60eeb37
Compare
8fdbbdb to
9e476d5
Compare
|
The real issue was requesting an index that was a multiple of the page size, which would happen when trying to span pages when slicing. It would get stuck in an infinite loop whenever the requested item number is a multiple of the page size. Fixed this by incrementing the |
|
Huh, this reminds me of a recently discovered server bug where attempting to iterate over more than 10,000 datasources was giving an error. Does that sound like it could be related to this one having issues, or just coincidence? |
|
@jacalata Unrelated. This was me making a simple logic/math mistake when I initially wrote the slicing logic, and I did not create a proper test to span pages and catch it. |
The old logic for handling slices on QuerySet objects worked for toy examples when the result set was small, but would crash if having to work through too many items. This logic will work for all sizes of results.