Uploaded image for project: 'Moodle app'
  1. Moodle app
  2. MOBILE-2564

Store and reuse promises in CoreSite

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Minor Minor
    • None
    • DEV backlog
    • Web Services

      Right now in CoreWSProvider we store the promises and reuse them to prevent duplicated WS calls. This has been a great improvement in the app.

      However, I noticed a case where this doesn't work. In a place where the same WS call is made twice with a bit of delay we have this race condition:

      1. First call starts, checks if it's in cache.
      2. First call is not in cache, starts the WS call.
      3. Second call starts, check if it's in cache.
      4. First call ends and starts storing in DB.
      5. Second call is not in cache (yet), starts the WS call (again!).

      We could store the promises in CoreSite like we do in CoreWSProvider. In this case, we should only reuse the promise if the preSets are the same.

            Unassigned Unassigned
            dpalou Dani Palou
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.