I have a custom REST route that imports a CSV file. Everything works so far, but I get a timeout error because it's a really big CSV and it takes a long time. I want to make my REST route start the import process, then return a response while continuing to import.
register_rest_route('lws-admin/v1', '/customer/import', array(
'methods' => 'POST',
'callback' => function($request) {
// *start really long operation*
return array(
'message' => 'import started'
);
}
));