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

Prevent choice becoming locked for a long time

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Minor Minor
    • 3.0.7, 3.1.3
    • 3.0.6, 3.1.2
    • Choice
    • MOODLE_30_STABLE, MOODLE_31_STABLE
    • MOODLE_30_STABLE, MOODLE_31_STABLE
    • MDL-56131-master
    • 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

      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.

            maherne Michael Aherne
            maherne Michael Aherne
            Andrew Lyons Andrew Lyons
            Dan Poltawski Dan Poltawski
            John Okely John Okely
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

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