Permalink
Browse files

Don't keep trying to GET the properties of a missing revision

  • Loading branch information...
1 parent 911f9c7 commit de4bacd3104af84fcd7053c45d4c392b2b61e77f @snej snej committed Sep 10, 2012
Showing with 6 additions and 1 deletion.
  1. +1 −0 Couch/CouchRevision.h
  2. +5 −1 Couch/CouchRevision.m
View
@@ -22,6 +22,7 @@
@private
NSDictionary* _properties;
BOOL _isDeleted;
+ BOOL _gotProperties;
}
/** The document this is a revision of. */
View
@@ -128,7 +128,7 @@ - (BOOL) propertiesAreLoaded {
- (NSDictionary*) properties {
- if (!_properties) {
+ if (!_properties && !_gotProperties) {
[[self GET] wait]; // synchronous!
}
return _properties;
@@ -143,6 +143,7 @@ - (void) setProperties: (NSDictionary*)properties {
_properties = [properties copy];
_isDeleted = [$castIf(NSNumber, [properties objectForKey: @"_deleted"]) boolValue];
}
+ _gotProperties = YES;
}
@@ -213,6 +214,9 @@ - (NSError*) operation: (RESTOperation*)op willCompleteWithError: (NSError*)erro
if (rev)
[self.document setCurrentRevisionID: rev];
}
+ } else if (op.isGET && op.httpStatus == 404) {
+ // Remember that we've checked for properties
+ _gotProperties = YES;
}
if (!op.isReadOnly)

0 comments on commit de4bacd

Please sign in to comment.