Skip to main content
Solved

API Call Concurrency issue

  • 20 May 2024
  • 2 replies
  • 72 views

I have an automation with several workspaces in series, the last one taking results from the previous and sending them as a series of API requests to a software.

 

general outline



the software has an antiforgery token that has to first be requested, then updated, so the final POST ends up being the 4th HTTP Caller.

 

API Call Workspace



The problem i’m having is slowing down the rate at which concurrent API calls are happening, so if multiple requests hit at approximately the same time, one of them will fail due to not receiving a new antiforgery token.

High priority has a second engine assigned only to it, and this is the only workspace that utilizes that job queue
Retry Settings



i have added a queue to the workspace runner, with it’s own engine, I also added a decelerator to the beginning of the workspace with a 20 second delay  in the hopes that the “first” API workspace would complete before the second one started, but, so far it has not been effective. 

when it fails, it fails with an empty response from the initial xref token response (antiforgery token)

48    2024-5-20 11:28:29 | HTTPCaller_-_GET_XSRF (HTTPFactory): (5]: HTTP transfer summary (ADDRESS REDACTED): status code: 200, download size: 0 bytes, DNS lookup time: 6 ms, total transfer time: 82 ms
49    2024-5-20 11:28:29 | AttributeManager_3: Unable to match regular expression '=u^;]*' to any substrings in '0'


From Testing with postman, it looks like the API endpoint is the hold-up. while i can send requests every ~second or so and get responses, the xref token doesn’t update that quickly so shows up as a refreshed token instead of a new one, so the parsing i do to pick out the new code doesn’t work, since i’m not looking for the refreshed token. 


So what i ultimately need to do is have a ~10 second delay between workspace runs and no concurrency - just one workspace at a time.

I thought the stuff i was doing above would accomplish that, but, i am still getting errors, so i suspect that is not the case.

 

i am unsure how to proceed.​​​​​​

2 replies

Userlevel 1
Badge +22

I see you have a Decelerator at the beginning of the API Call Workspace but not between the different HTTPCallers. Try putting one before each Caller and see what happens. Or have you already tried this?

A couple of years ago I solved something similar by Decelerating between HTTPCallers.

Hope it helps.

Userlevel 1
Badge +7

@caracadrian i’ve added these, and noticed less issues, but not a complete solution for issues. 

but hey - step in the right direction, right?

Fortunately, the company in question seems to have realized that their 4 request method is… cumbersome and re-implemented token auth, which takes us down to 2 calls - i haven’t had the time to edit the workspace to reflect that, but, i suspect between the decelerator between calls and dropping the volume of calls in the workspace will likely do the trick (fingers crossed!)

Reply