Simultaneous requests on API endpoint

I have a API endpoint that takes ~15sec to run and if 2nd request for that enpoint comes while 1st request is still running it seems to abort 1st request and start the 2nd. Is this expected behaviour? I have since locked the API endpoint down by setting bool on user record and reset on wf completion. The user may have actions on RG which will call this API but now they must wait 15 sec for the API to complete each time. Not very elegant. Is there another way?

Submitting a 2nd API request shouldn’t interfere with the first one. Requests are supposed to be queue’d.

I think the solution for the 2nd part of your question depends on how your app works, what data you’re grabbing through the API, etc. Some potential solutions may include: grabbing all of the data right after the page loads so that it’s available more quickly if the user clicks something that ask for it. Or, perhaps store it all in your database ahead of time (for example, load all of it through the API each night or each week). You may also be able to optimize your query so that it doesn’t require so many lookups (i.e., using “search for”) or nested searches, which can be really slow.

1 Like