-
Notifications
You must be signed in to change notification settings - Fork 66
CouchQuery stores error of the last request #32
Conversation
Thanks! Just a few minor issues... |
Updated the code as you suggested. |
Hm, this method works fine with all sorts of failed requests that return at least some kind of response. To catch also the timeout error I could of course move the error property to the CouchResource class, but not sure whether this is the best way to do it. |
Can you explain in more detail? CouchQuery overrides that method, so I don't see a way for the CouchResource implementation to be called without going through the CouchQuery override. RESTOperation treats HTTP error statuses and socket-level errors the same way; they both call -completedWithError:, which in turn calls the owning resource's -operation:willCompleteWithError:. |
For my test I made all requests to xyz.iriscouch.com time out.
(*) I added comments to all the operation:willCompleteWithError: methods to see which where called and to find out why the error isn't stored in the error property. |
I don't think it does — I can't see any place in that code path that will block. And I ran the TouchDB iOS demo and looked at all the calls to -[RESTOperation wait], and none were invoked on a view. Can you pause the app while it's blocked in the synchronous call and show me the backtrace (use the 'bt' debugger command)?
Please set a breakpoint in the CouchResource method and send me the backtrace when it was hit. I think it must be invoked from the 'super' call in the CouchQuery method. |
To the first point: (lldb) bt
|
Sorry, I would, but I can't get that to work :-( I'm already googling for an answer, but until now nothing worked. |
But this hack http://stackoverflow.com/a/9603733 might help out a little bit. 2012-07-03 19:38:12.695 Lingya[24106:11303] Stack = 1 When a timeout occurs, the method is called from RESTOperation, not from CouchQuery. |
Re the timeout: your backtrace shows it's coming from setting the tracksChanges property of the database, which CouchUITableSource does so it can listen for changes. (Setting -tracksChanges gets the db's latest sequence number via a synchronous call — this could perhaps be fixed to be async.) I'll review your pull request again — sorry for the delay, was stuck with a bunch of Couchbase Server tasks this week. |
CouchQuery stores error of the last request
Readonly error property stores the error of the last request.