Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set connection timeout for Parse queries

I'm testing a query on Parse using the findInBackground() method under different connection types. When connection is not available, there are times in which the done() callback returns, as expected, the following exception after few seconds:

com.parse.ParseException: i/o failure: org.apache.http.conn.HttpHostConnectException: Connection to https://api.parse.com refused

But there are times in which it takes like 30-60 seconds to be thrown, or even is not called at all.

Is there a way to control this behavior? I would like to set a fixed timeout, like 10 seconds.

like image 319
TheUnexpected Avatar asked Jul 11 '14 07:07

TheUnexpected


1 Answers

You could have your own timer that starts when you run findInBackground. If the timer is exceeded before findInBackground responds, then you could update you app appropriately. When the findInBackground finally does respond back, you can ignore the response.

If you tell me which language you're using, I could probably come up with actual code if you'd like.

like image 154
Dehli Avatar answered Nov 20 '22 04:11

Dehli