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

Prevent choice becoming locked for a long time

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.0.6, 3.1.2
    • Fix Version/s: 3.0.7, 3.1.3
    • Component/s: Choice
    • Labels:
    • Testing Instructions:
      Hide
      1. Add to your config.php:

        $CFG->lock_factory = '\core\lock\db_record_lock_factory';
        

      2. Create a choice activity with limited responses
      3. Ensure that choices can be saved
      4. Open mod/choice/lib.php in your editor and add a sleep of 60 seconds after the call to get_lock in choice_user_submit_response()
      5. Submit a choice selection and, during the sleep period, killall httpd (modify as required)
      6. Remove the sleep you added
      7. As another user, immediately try to submit a value
        1. Confirm that you were shown the error:

          Sorry, there was a problem submitting your choice. Please try again.

      8. Wait one minute
      9. Try to submit again
        1. Confirm that your submission was accepted
      Show
      Add to your config.php: $CFG->lock_factory = '\core\lock\db_record_lock_factory'; Create a choice activity with limited responses Ensure that choices can be saved Open mod/choice/lib.php in your editor and add a sleep of 60 seconds after the call to get_lock in choice_user_submit_response() Submit a choice selection and, during the sleep period, killall httpd (modify as required) Remove the sleep you added As another user, immediately try to submit a value Confirm that you were shown the error : Sorry, there was a problem submitting your choice. Please try again. Wait one minute Try to submit again Confirm that your submission was accepted
    • Affected Branches:
      MOODLE_30_STABLE, MOODLE_31_STABLE
    • Fixed Branches:
      MOODLE_30_STABLE, MOODLE_31_STABLE
    • Pull Master Branch:
      MDL-56131-master

      Description

      The choice activity uses the lock API to avoid more than the allowed number of users selecting a given option, but doesn't pass the $maxlifetime parameter, which means that if anything goes wrong the choice can be unavailable for 24 hours (the default).

      It would be better if a reasonable value could be set for this, that would be long enough to be ensure that the lock didn't expire before the choice was saved, but not so long that students are locked out of the activity for a whole day.

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                14/Nov/16