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
What would the maximum delay be? I hope it wouldn't get put at the end of the queue and subject to 10's of minutes. That might break the expectations of some clients.
I will need to check, but I think if we put it to different queue than other tasks it will only wait for other similar items. This means that other types of tasks won't affect the wait time, but similar tasks will. Right now we're not getting an awful lot of these requests. I only found around 50 from October 17th. If this is the case, the wait will most likely be in tens of seconds (depending on the number of compared results).
milosz
Dan
Is this the solution we should aim for? The downside is that it requires active polling from the client side.
milosz _______________________________________________ Squad-dev mailing list Squad-dev@lists.linaro.org https://lists.linaro.org/mailman/listinfo/squad-dev