On Tue, Oct 30, 2018 at 06:05:18PM +0000, Milosz Wasilewski wrote:
On Tue, 30 Oct 2018 at 17:55, Dan Rue dan.rue@linaro.org wrote:
On Tue, Oct 30, 2018 at 05:30:01PM +0000, Milosz Wasilewski wrote:
Hi,
Getting the output of 'email' API for the build usually takes a long time. In some cases we're close to hitting the 30 seconds timeout. I think the timeout is inevitable when there are a lot of results with big number of changes. In order to avoid timeout, maybe the API should do the work in background? This would work as follows
- GET call to /api/builds/<id>/email
- server creates a 'cashed report' object in database and returns URL
for it immediately to the user 3. in the background server adds a report generation task to the queue 4. using the URL received in 2) user is able to retrieve the final results or check the progress 5. once the result is generated it can be a short lived object in the database (removed after 1 day for example)
I think it's a good idea, and might be a useful pattern for other query/report types in the future.
It may need a different endpoint than /email - perhaps /email-async or /email?async=true? It's best not to break existing behavior, which is probably suitable for most projects.
sounds reasonable
I would rather have a new, totally different endpoint for "report" objects, this one being the first type of them.
Also, maybe it would be worth it trying to squeeze some performance out of the current code to see if we can avoid having to do this.