-
Type: Improvement
-
Status: Resolved
-
Priority: Minor
-
Resolution: Fixed
-
Affects Version/s: 4.1.2
-
Fix Version/s: 4.1.3
-
Component/s: Remote client
-
Epic Link:
-
Tags:
Problem
The current code calls twice NuxeoDrive.ScrollDescendants for each and every folder.
It will call it the first time to get (at most) N descendants and recall it until it's empty.
Example
If a folder A contains 10 text files, the operation will be called once, and retrieve the 10 descendants. Then the operation will be called again, and retrieve no descendants, so the loop will stop. This amounts to 2 calls to the server.
However, we know that we ask for 100-item pages, so by receiving only 10 descendants, we know we won't get more on the next call, so we could stop at only 1 call.
Solution
It can be optimized by finishing the scroll if the number of descendants received is less than N.
Here, N is hard coded to 100. We will move it to the BATCH_SIZE constant.
Result
In theory, it will make one less call to the server per-folder. If on average, folders have less than BATCH_SIZE documents inside them, it will essentially divide the amount of calls to the server by 2 for this operation.
- causes
-
NXDRIVE-1832 Fix a regression that prevents deep structure sync
- Resolved
- is related to
-
NXP-28035 Improve the NuxeoDrive.ScrollDescendants contract
- Open