The code in the function looks something like this:
var result = serviceCall.getResult();
…continue processing and use the result
There is a very small delay in the serviceCall.execute before the results come back (less that a second in my unscientific observations). That causes the result to be null and the rest of the function to not behave as expected.
I tried adding a Do…While loop to wait for result to be not null. But, I’m not happy with the performance – it added an almost 6 second delay.
Do you have a recommended way to wait for a service call to complete?