Execute callback after REST API request completes + Response is sent
You can look into queues e.g. create a custom database table, and write to it within the rest_post_dispatch or rest_pre_serve_request filter just before it is dispatched. Then you can bulk process the queue (first record in is the first record out) via e.g. wp-cron and the user will not be affected by that potentially heavy … Read more