+ Start a Discussion
BJamesBJames 

Async query timeout?

I'm trying to figure out what errors I need to handle in my application and  a question came up that "...is it possible for an async call to the query method to timeout"?

  I looked through the community and googled around and could not find much!

-=Bryan


Ron HessRon Hess
not sure if this is the same thing, but to simulate a timeout, try writing a large query, with the async handler.
Then test this query make sure it works, then test again and just when you hit the query ( + 1 second) , unplug your network wire.

you should see something fail, i've not tried this, so let us know what happens if you run this


darozdaroz

Ron Hess wrote:
not sure if this is the same thing, but to simulate a timeout, try writing a large query, with the async handler.
Then test this query make sure it works, then test again and just when you hit the query ( + 1 second) , unplug your network wire.

you should see something fail, i've not tried this, so let us know what happens if you run this



Just an FYI - Depending on the OS/Browser the results will likely come back not as you expect. If you pull your computer's network cable out the hardware interface will go down. Most OSes (Win 2K/XP/2003, Linux for sure) will report back a socket error, or a connection reset nearly immediately when the cable is pulled. If the browser doesn't trap those errors internally (why would they?) and they get exposed to the JS stack you won't experience a timeout condition, but rather an exception (or the like) should be thrown.

If you really need to test a timeout condition I'd suggest the following (depending on your setup). If you can get another hub in between your PC and the rest of your network this will work almost as-written. Instead of disconnecting your PC's cable, disconnect the connection from your local hub upstream to the rest of your network. This will leave the local PC network interface up and the PC will not know the rest of the world just went buh bye... Second option is to firewall the connection to SFDC mid-query. You can use a local PC firewall or tweak your company's firewall (careful to only firewall to/from the SFDC server and your PC's IP.

Ron HessRon Hess
good tip,
spoken like someone who knows the many faces of network stack failure :smileysurprised: