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

Allow a 'random' value to be set in scheduled tasks time definition

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.7
    • Fix Version/s: 2.8
    • Component/s: Libraries
    • Testing Instructions:
      Hide

      Note that testing anything with random values is tricky - theoretically you could get the same values 100x in a row, so remember to repeat if it looks like you are not getting something random.

      1. Edit enrol/imsenterprise/db/tasks.php and change the hour and minute fields to R
      2. Edit enrol/imsenterprise/version.php and increment the version
      3. Observe the scheduled tasks screen for the Enrolment file processing task and note the minute and hour
      4. Edit enrol/imsenterprise/version.php and increment the version
      5. Observe the scheduled tasks screen for the Enrolment file processing task and note the minute and hour - it should have changed
      6. Repeat this a few times and VERIFY the minute and hour are changign to random values
      7. Edit the task and tick the 'reset to defaults' button and VERIFY the time changes to random values
      8. Change your moodle prefix to do a new install - verify that the time for IMS enrollment has changed to a random value.
      9. Run unit tests
      Show
      Note that testing anything with random values is tricky - theoretically you could get the same values 100x in a row, so remember to repeat if it looks like you are not getting something random. Edit enrol/imsenterprise/db/tasks.php and change the hour and minute fields to R Edit enrol/imsenterprise/version.php and increment the version Observe the scheduled tasks screen for the Enrolment file processing task and note the minute and hour Edit enrol/imsenterprise/version.php and increment the version Observe the scheduled tasks screen for the Enrolment file processing task and note the minute and hour - it should have changed Repeat this a few times and VERIFY the minute and hour are changign to random values Edit the task and tick the 'reset to defaults' button and VERIFY the time changes to random values Change your moodle prefix to do a new install - verify that the time for IMS enrollment has changed to a random value. Run unit tests
    • Affected Branches:
      MOODLE_27_STABLE
    • Fixed Branches:
      MOODLE_28_STABLE
    • Pull Master Branch:
      MDL-47221-master

      Description

      Sometimes it would be useful to be able to set a 'random' value for the scheduled tasks time value. i.e. When dealing with remote servers, its useful to avoid every single request from automated checks hitting the server at the same time.

      What i'd like is define a 'random' minute value for my task, then when the task is installed - Moodle will choose a random time to set it in the database for each Moodle install.

      I don't think its necessary for this to be exposed to users (and think its better that its defined in the database as a fixed time), its simply to distribute the timings across Moodle installs.

      I need this for MDL-46210 - I can imagine other uses - like converting the updates API checker.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              poltawski Dan Poltawski
              Reporter:
              poltawski Dan Poltawski
              Peer reviewer:
              Juan Leyva
              Integrator:
              Marina Glancy
              Tester:
              Ankit Agarwal
              Participants:
              Component watchers:
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón
              Votes:
              2 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                10/Nov/14