Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

There was an issue with the cached client blocking or something and a…

… call to db.view after doing a few other calls was hanging for no reason. I got rid of the cache because of this. Is there a good reason to keep the cache?
  • Loading branch information...
commit 7768f178cf45a792eceae1df899d203ac6db3832 1 parent 2ecea22
@jasonwyatt jasonwyatt authored committed
Showing with 6 additions and 15 deletions.
  1. +6 −15 lib/index.js
View
21 lib/index.js
@@ -25,27 +25,18 @@ var sys = require('sys'),
url = require('url'),
base64 = require('./base64');
-var clients = {};
-function cache_client(host) {
+function createClient(host) {
// summary:
- // Creates or fetches an HTTP Client for the specified host.
+ // Creates an HTTP Client for the specified host.
// description:
- // If we've already created an HTTPClient object for the host
- // argument, fetch it from the client cache object. Otherwise,
- // create a new HTTPClient object and return it after adding it to
- // the cache.
+ // Create a new HTTPClient object and return it
// host: String
// CouchDB Host URL.
// returns:
// An HTTPClient object associated with the specified host.
- var client = clients[host];
- if (client) {
- return client;
- } else {
- var uri = url.parse(host);
- return clients[host] = http.createClient(uri.port, uri.hostname);
- }
+ var uri = url.parse(host);
+ return http.createClient(uri.port, uri.hostname);
}
function _interact(verb, path, successStatus, options, host) {
@@ -84,7 +75,7 @@ function _interact(verb, path, successStatus, options, host) {
// placeholder for the HTTP request object.
var request;
- var client = cache_client(host);
+ var client = createClient(host);
var requestPath = path + encodeOptions(options);
if (CouchDB.debug) {
sys.puts("COUCHING " + requestPath + " -> " + verb);
Please sign in to comment.
Something went wrong with that request. Please try again.