Hi,

We have huge quizzes with more than 600 questions each. When we add those 600 questions from the question bank to newly created quiz, the vbo action timeouts (we are stuck with a server on which we cannot modify the PHP timeouts and the PHP-FPM proxy timeout).

However, we tried to add the questions progressively by small groups but the VBO action takes more time each time we add new questions to the quiz and finally we reach our timeout limit again.

I've checked the source and found out that the VBO action responsible for adding questions to the quiz for each question to add :

  1. Loads the quiz;
  2. Get all the the quiz questions;
  3. Loops over the questions to find out if the question is already bound to the quiz;
  4. If not, binds the question to the quiz.

So, if I add 200 questions from the question bank to a quiz, for the first question to add, the VBO action will loop over 0 questions, then for the second question over 1 questions, then for the second question over 2 questions, then 3, then 4, ... Which in the end will make (if my maths are correct) 20100 loops over the quiz questions to check if they are not already bound to the quiz...

Anyway, we come up with a solution using drupal static in the VBO action. We "cache" the quiz and its questions so that for each question to add, we don't have to load and loop over all the questions again.

The patch is attached.

Best Regards,

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Sami Radi created an issue. See original summary.

Da_Cloud’s picture

Status: Active » Needs review
djdevin’s picture

Version: 7.x-5.1 » 7.x-5.x-dev

Hi,

Thank you for your patch. The code in question was very old and wasn't touched since D6. I took a simpler approach and used EFQ which should also fix the issue.

djdevin’s picture

  • djdevin committed 0d98edb on 7.x-5.x authored by Sami Radi
    Issue #2879052 by Sami Radi, djdevin: Quiz crashes when adding a large...
djdevin’s picture

Status: Needs review » Fixed

Thanks. Fixed!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.