Question imports can take a long while. This can confuse the user or even lead to execution timeouts.

Let's use the Batch API to get around timeouts and update the user on how the import is progressing.

http://api.drupal.org/api/group/batch

Comments

turadg’s picture

This is harder than I thought, since the process is delegated to each engine+format for the actual operations.

If anyone wants to try this, a good start is by mimicking image_import_form_submit() in image_import.pages.inc

Until this is implemented, big imports may require that the max execution time is increased. We can also try working around it during imports by using ini_set(), when available:

ini_set('max_execution_time', '0'); // 0 = no limit.

That is only for the duration of the request.

sivaji_ganesh_jojodae’s picture

I don't think it is required for now. I can import around one thousand questions in less than 3 seconds. I am tempted to mark this as won't fix (at least postponed).

FYI : drupal database backup modules are using this function ini_set('max_execution_time', '0'); // 0 = no limit.

mbutcher’s picture

Status: Active » Postponed

This is probably unnecessary for the time being, and implementing it would slow down the alpha release. Unless we have a real world use case, I'd suggest postponing this until it is requested.

turadg’s picture

3 seconds, woah. My imports can take several minutes. I'm importing from WebCT format.

So I present my case as real world, but I expect it's not common. I agree this can wait for 4.1 or later.

falcon’s picture

Version: 6.x-4.x-dev » 6.x-5.x-dev
falcon’s picture

Project: Quiz » Quiz EI
Version: 6.x-5.x-dev » 6.x-4.0-alpha1
Component: Code - Import/Export » Code