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

Configurable request timeouts in oauth and rest clients (and saner defaults)

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.6
    • Fix Version/s: None
    • Component/s: Other, Web Services
    • Labels:
      None
    • Affected Branches:
      MOODLE_36_STABLE

      Description

      The default curl timeout for request seems to be 30 seconds. I'd say that, for most cases, this is a bit excessive. Considering that we are increasingly connecting Moodle to other systems and services behind the scenes (consider Google drive, Nextcloud,  but also plugins such as the Opencast block) we need to make sure that trivial things can fail quickly, so that overall loading time is not affected too much.

      Right now I have these classes in mind: oauth2_client (extending from curl) and  core\oauth2\rest (using curl as a delegate). There are probably more...

      I think these classes should

      a) provide easier methods to explicitly reduce the timeout, as an abstraction to CURLOPT_CONNECTTIMEOUT, CURLOPT_TIMEOUT, and
      b) use a shorter default (for most things, ~1 second?)

       

      Particularly with respect to a), I think that establishing a connection implicitly (such as obtaining a new access token) could have a timeout of 0.5 seconds, so that the effect on the loading time is lower when the remote server is down. However, when we perform actions on the remote server that are known to be complex, the developer could willingly increase the timeout to 30 seconds or even more.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              jan.dagefoerde Jan Dageförde
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Juan Leyva, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona)
              Votes:
              5 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated: