Permalink
Browse files

BugFix #15: it was causing strange timeout issues to occur with subse…

…quent calls.
  • Loading branch information...
1 parent 56b7af6 commit 36fed28a40fada40ffcfdff8d0b0b0a98d2ba71c @soitgoes committed Dec 13, 2011
Showing with 14 additions and 8 deletions.
  1. +14 −8 LoveSeat/CouchClient.cs
@@ -166,15 +166,21 @@ public void DeleteAdminUser(string userToDelete)
/// </summary>
/// <param name="databaseName"></param>
/// <returns></returns>
- public bool HasDatabase(string databaseName)
- {
+ public bool HasDatabase(string databaseName) {
var request = GetRequest(baseUri + databaseName);
- request.Timeout = 5000;
- var result = request
- .Get()
- .GetResponse();
- return result.StatusCode == HttpStatusCode.OK;
- }
+ request.Timeout = -1;
+
+ var response = request.GetResponse();
+ var pDocResult = new Document(response.GetResponseString());
+
+ if (pDocResult["error"] == null) {
+ return (true);
+ }
+ if (pDocResult["error"].Value<String>() == "not_found") {
+ return (false);
+ }
+ throw new Exception(pDocResult["error"].Value<String>());
+ }
/// <summary>
/// Returns true/false depending on whether or not the user is contained in the _users database

0 comments on commit 36fed28

Please sign in to comment.