In order to add the ability of bulk API requests to my api I have added a new method to one my controllers.
The method takes as input an array of objects and calls another method in the same controller (which may throw an exception).
see the following code:
foreach ($objects as $object) {
$request = (array)$object;
$request = Request::create('/someinternalurl', 'POST', $request);
$response = app()->dispatch($request);
$responses[] = json_decode($response->getContent());
}
the problem is that for 10 objects for example, this code takes about 15 seconds.
In addition i have tried to search for other solutions, but all i found seems to result
the same respone time or many changes to my API.
Thank you
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2Pqw9lw
via IFTTT
Aucun commentaire:
Enregistrer un commentaire