From 3b431fc0b30c5fb110afd06347058727724f0fb2 Mon Sep 17 00:00:00 2001 From: "Damien F. Katz" Date: Tue, 17 Feb 2009 14:01:51 +0000 Subject: Put file ref_counting into it's own module, to make the speed of opening an already open database faster (by not waiting on file pending operations, particularly fsync). git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@745076 13f79535-47bb-0310-9956-ffa450edef68 --- src/couchdb/couch_server.erl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/couchdb/couch_server.erl') diff --git a/src/couchdb/couch_server.erl b/src/couchdb/couch_server.erl index 69cfa36c..39b33c63 100644 --- a/src/couchdb/couch_server.erl +++ b/src/couchdb/couch_server.erl @@ -195,15 +195,15 @@ try_close_lru(StartTime) -> true -> [{_, DbName}] = ets:lookup(couch_dbs_by_lru, LruTime), [{_, {MainPid, LruTime}}] = ets:lookup(couch_dbs_by_name, DbName), - case couch_db:num_refs(MainPid) of - 0 -> + case couch_db:is_idle(MainPid) of + true -> exit(MainPid, kill), receive {'EXIT', MainPid, _Reason} -> ok end, true = ets:delete(couch_dbs_by_lru, LruTime), true = ets:delete(couch_dbs_by_name, DbName), true = ets:delete(couch_dbs_by_pid, MainPid), ok; - _NumRefs -> + false -> % this still has referrers. Go ahead and give it a current lru time % and try the next one in the table. NewLruTime = now(), -- cgit v1.2.3