summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul J. Davis <paul.joseph.davis@gmail.com>2017-07-11 18:25:39 -0500
committerPaul J. Davis <paul.joseph.davis@gmail.com>2017-07-19 11:11:42 -0500
commit91ea49482e5f9975630b00e7aa7fbf73be527d51 (patch)
treea5e159d9fbbffa6c6f30bb3a4904fe2f21958c1f
parent652b2631831f2fdfa974f11af54f3d9a20ecbce5 (diff)
downloadcouchdb-91ea49482e5f9975630b00e7aa7fbf73be527d51.tar.gz
FIXUP: Move invalidation to ddoc_cache_entry
-rw-r--r--src/ddoc_cache/src/ddoc_cache_entry.erl4
-rw-r--r--src/ddoc_cache/src/ddoc_cache_lru.erl5
2 files changed, 4 insertions, 5 deletions
diff --git a/src/ddoc_cache/src/ddoc_cache_entry.erl b/src/ddoc_cache/src/ddoc_cache_entry.erl
index 00259043c..85108e7ba 100644
--- a/src/ddoc_cache/src/ddoc_cache_entry.erl
+++ b/src/ddoc_cache/src/ddoc_cache_entry.erl
@@ -196,6 +196,10 @@ handle_cast(force_refresh, St) ->
NewSt = if St#st.accessed > 0 -> St; true ->
St#st{accessed = 1}
end,
+ % We remove the cache entry value so that any
+ % new client comes to us for the refreshed
+ % value.
+ true = ets:update_element(?CACHE, St#st.key, {#entry.value, undefined}),
handle_cast(refresh, NewSt);
handle_cast(refresh, #st{accessed = 0} = St) ->
diff --git a/src/ddoc_cache/src/ddoc_cache_lru.erl b/src/ddoc_cache/src/ddoc_cache_lru.erl
index 2d8a371c6..82d7245ed 100644
--- a/src/ddoc_cache/src/ddoc_cache_lru.erl
+++ b/src/ddoc_cache/src/ddoc_cache_lru.erl
@@ -178,11 +178,6 @@ handle_cast({do_refresh, DbName, DDocIdList}, St) ->
case khash:lookup(DDocIds, DDocId) of
{value, Keys} ->
khash:fold(Keys, fun(Key, Pid, _) ->
- % We're erasing the value from cache here
- % so that new clients will wait for the
- % refresh to complete.
- Op = [{#entry.val, undefined}],
- true = ets:update_element(?CACHE, Key, Op),
ddoc_cache_entry:refresh(Pid)
end, nil);
not_found ->