Is there an upper limit on the time that httpClient waitForComplete will wait ?

Not applicable

httpClient waitForComplete returns before the response is populated when waiting times are high. Is there a maximum time that we can wait ?

1 1 456
1 REPLY 1

Good Question!

I guess you would want to know two things:

  1. what is the default wait time when waitForComplete() is called with no argument?
  2. what is the max wait time that can be specified to waitForComplete()?

Unfortunately, I don't believe this is documented. The good news is, I can tell you the answer.

As for the first question, regarding the default wait time. The httpClient.waitForComplete will wait either 120 seconds, or for the timeLimit on the JS policy itself, whichever is lower.

As it has been implemented, the default wait time is the maximum wait time. Therefore the answer to the second question is the same.

Now we have to ask the similar question for this limit: what is the default and maximum-specifiable timeLimit on a JavaScript callout policy?

  • Default: Not certain (I think this is also not documented), but I believe 200ms.
  • Max: on Edge Saas Trial accounts: 200ms. On Edge SaaS commercial accounts: I don't know.

Ok, let's look at an example. Suppose I have this JS Policy:

<Javascript name='JS-ObtainExternalToken'>
  <IncludeURL>jsc://utility.js</IncludeURL>
  <ResourceURL>jsc://obtainExternalToken.js</ResourceURL>
</Javascript>

If the JavaScript code in obtainExternalToken.js uses httpClient and calls waitForComplete(500), then the actual wait time will be 200ms.

Now, what happens when we modify the policy configuration to be like this, just adding an explicit timeLimit:

<Javascript name='JS-ObtainExternalToken' timeLimit='1200' >
  <IncludeURL>jsc://utility.js</IncludeURL>
  <ResourceURL>jsc://obtainExternalToken.js</ResourceURL>
</Javascript>

Now, with the same JavaScript code in obtainExternalToken.js, the actual wait time will be 500ms on a commercial Edge SaaS org, or still 200ms on a trial Edge SaaS org.

@Floyd Jones - you might want to have a look see regarding the max and defaults for timeLimit and waitForDefault.