@@ -81,7 +81,7 @@ namespace DocumentDB.ChangeFeedProcessor
81
81
/// </example>
82
82
public class ChangeFeedEventHost : IPartitionObserver < DocumentServiceLease >
83
83
{
84
- const string DefaultUserAgentSuffix = "changefeed-0.3.1 " ;
84
+ const string DefaultUserAgentSuffix = "changefeed-0.3.2 " ;
85
85
const string LeaseContainerName = "docdb-changefeed" ;
86
86
const string LSNPropertyName = "_lsn" ;
87
87
@@ -854,7 +854,7 @@ private static string ParseAmountFromSessionToken(string sessionToken)
854
854
return sessionToken . Substring ( separatorIndex + 1 ) ;
855
855
}
856
856
857
- private static int GetDocumentCount ( ResourceResponse < DocumentCollection > response )
857
+ private static Int64 GetDocumentCount ( ResourceResponse < DocumentCollection > response )
858
858
{
859
859
Debug . Assert ( response != null ) ;
860
860
@@ -865,9 +865,19 @@ private static int GetDocumentCount(ResourceResponse<DocumentCollection> respons
865
865
foreach ( var part in parts )
866
866
{
867
867
var name = part . Split ( '=' ) ;
868
- if ( string . Equals ( name [ 0 ] , "documentsCount" , StringComparison . OrdinalIgnoreCase ) )
868
+ if ( name . Length > 1 && string . Equals ( name [ 0 ] , "documentsCount" , StringComparison . OrdinalIgnoreCase ) && ! string . IsNullOrEmpty ( name [ 1 ] ) )
869
869
{
870
- return int . Parse ( name [ 1 ] ) ;
870
+ Int64 result = - 1 ;
871
+ if ( Int64 . TryParse ( name [ 1 ] , out result ) )
872
+ {
873
+ return result ;
874
+ }
875
+ else
876
+ {
877
+ TraceLog . Error ( string . Format ( "Failed to get document count from response, can't Int64.TryParse('{0}')" , part ) ) ;
878
+ }
879
+
880
+ break ;
871
881
}
872
882
}
873
883
}
0 commit comments