wordpress-importer icon indicating copy to clipboard operation
wordpress-importer copied to clipboard

Improvement - import in batches using AJAX or background job?

Open dingo-d opened this issue 4 years ago • 0 comments

When doing larger imports it often happens that the import script breaks/time outs.

One possible solution is to increase timeout in the php.ini, but not all users have this ability (especially those on shared hostings).

One solution would be to import items in batches using ajax - this will make the script less prone to timeouts.

Another solution would be to register and immediately execute running a background job using wp_schedule_single_event()

wp_schedule_single_event( time() - 1, 'wp_import_all_things' );

This should start the import job in the background, as a separate process, so, in theory, it would also be less prone to errors and timeouts.

However we would need some indication if the job is running, has run successfully or if it has errored out for some reason.

Any thoughts?

dingo-d avatar Nov 27 '19 12:11 dingo-d