• Charles dB
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies

If you execute two javascript remoting calls in the same Javascript batch, those calls get lumped together as a single request and share an Apex context and governor limits.  For example:

 

function doSomething()
{
    controller.remoteCall1();
    controller.remoteCall2();
}

 Doing that will result in one remoting request instead of two.  This is especially problematic if one of those two calls is a call to a method marked as @ReadOnly and the other is not.  Is there a good way to get around this behavior?  Are calls only batched if they're executed within the same Javascript context/event or is there a peroid of time within which all calls are automatically batched?

 

I have had some success using setTimeout() to execute each call in it's own context, but I want to make sure this is a valid way to handle this.  Are there lmiits to the number of javascript remoting requests that can be made in parallel?

 

Thanks,

  • January 27, 2012
  • Like
  • 0