Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-79422

nologin WS fetches should not fail subsequent requests on error

XMLWordPrintable

    • MOODLE_401_STABLE, MOODLE_402_STABLE, MOODLE_403_STABLE
    • MOODLE_401_STABLE, MOODLE_402_STABLE, MOODLE_403_STABLE
    • MDL-79422-401
    • MDL-79422-master
    • Hide
      1. Run npx grunt watch
      2. Edit lib/amd/src/modal_registry.js in your preferred editor
      3. Find the following line in the register function:

        Prefetch.prefetchTemplate(template);
        

      4. Modify it to:

        Prefetch.prefetchTemplate(`${template}/missing`); Prefetch.prefetchTemplate(template);
        

      5. Open Moodle
      6. Open the Developer tools in your browser and switch to "Network"
      7. Navigate to a course
      8. Turn editing on
      9. Look through the list of calls and find any to service-nologin.php which have an info statement like [number]-method-calls
      10. Click on the response "Preview" (may be called soemthing different but its the preview not the raw response we want)
      11. Find one that has an error: true line
        1. Confirm that there are responses after that line which have succeeded
      Show
      Run npx grunt watch Edit lib/amd/src/modal_registry.js in your preferred editor Find the following line in the register function: Prefetch.prefetchTemplate(template); Modify it to: Prefetch.prefetchTemplate(`${template}/missing`); Prefetch.prefetchTemplate(template); Open Moodle Open the Developer tools in your browser and switch to "Network" Navigate to a course Turn editing on Look through the list of calls and find any to service-nologin.php which have an info statement like [number] -method-calls Click on the response "Preview" (may be called soemthing different but its the preview not the raw response we want) Find one that has an error: true line Confirm that there are responses after that line which have succeeded

      We just spent a few hour debugging an issue where a pre-fetch request which includes a missing templatle will cause all subsequent template requests in the same request to be rejected, whether or not they were actually related to the original one or not.

      This happens because of an over-zealous rule which basically says "if there is an error, fail all remaining requests in the call".

      That exists for the purposes of write safety. Imagine you have three requests in the same call:

      • backup my thing
      • reset it to its initial state
      • restore from the backup

      You would expec this to always reset it and reapply the backuip.
      But what if the backup fails?
      If we just continued with subsequent requests in the call, we'd fail on step 1, reset to initial state, and have nothing to restore. DATA LOSS. So to avoid that we reject everything in the same request.

      Now this really doesn't and shouldn't apply to nologin requests. They:

      • come through a different endpoint
      • do not allow any write of any kind (because there is no user logged in for them)

      These should be entirely safe because they are unable to make changes anyway.

      So I believe we can modify the service.php endpoint to not reject following calls in the case of a prior error.

            dobedobedoh Andrew Lyons
            dobedobedoh Andrew Lyons
            Jake Dallimore Jake Dallimore
            Ilya Tregubov Ilya Tregubov
            Ron Carl Alfon Yu Ron Carl Alfon Yu
            Votes:
            0 Vote for this issue
            Watchers:
            14 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 day, 41 minutes
                1d 41m

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