Permalink
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...
1 parent 2ecea22 commit 7768f178cf45a792eceae1df899d203ac6db3832 @jasonwyatt jasonwyatt committed with Apr 25, 2010
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);

0 comments on commit 7768f17

Please sign in to comment.