Uploaded image for project: 'Nuxeo Drive '
  1. Nuxeo Drive
  2. NXDRIVE-1636

Reduce ScrollDescendants calls for each folder

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 4.1.2
    • Fix Version/s: 4.1.3
    • Component/s: Remote client

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 hour
                  1h