add query time to get_items API response
This commit is contained in:
parent
14f5591640
commit
ae6bf8ff88
|
@ -216,9 +216,13 @@ class REST_Items_Controller extends REST_Controller {
|
|||
if($request['collection_id']) {
|
||||
$collection_id = $request['collection_id'];
|
||||
}
|
||||
|
||||
|
||||
$query_start = microtime(true);
|
||||
|
||||
$items = $this->items_repository->fetch($args, $collection_id, 'WP_Query');
|
||||
|
||||
$query_end = microtime(true);
|
||||
|
||||
$response = [];
|
||||
|
||||
$return_template = false;
|
||||
|
@ -274,6 +278,8 @@ class REST_Items_Controller extends REST_Controller {
|
|||
|
||||
$rest_response->header('X-WP-Total', (int) $total_items);
|
||||
$rest_response->header('X-WP-TotalPages', (int) $max_pages);
|
||||
$rest_response->header('X-Tainacan-Query-Time', $query_end - $query_start);
|
||||
$rest_response->header('X-Tainacan-Elapsed-Time', microtime(true) - $query_start);
|
||||
|
||||
return $rest_response;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue