Skip to content
This repository was archived by the owner on Mar 15, 2022. It is now read-only.

Commit 449b875

Browse files
committed
Fix invariant/sanity check code.
The original code broke on an odd number of running threads.
1 parent 5ad3342 commit 449b875

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

test/test_cache_loops.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ def add_remove_to_zero(opts = {})
299299

300300
def add_remove_to_zero_via_merge_pair(opts = {})
301301
code = <<-RUBY_EVAL
302-
acc += (cache.merge_pair(key, key) {}) ? -1 : 1
302+
acc += (cache.merge_pair(key, key) {}) ? 1 : -1
303303
RUBY_EVAL
304304
do_thread_loop(:add_remove_to_zero_via_merge_pair, code, {:loop_count => 5}.merge(opts)) do |result, cache, options, keys|
305305
assert_all_key_mappings_exist(cache, keys, false)

0 commit comments

Comments
 (0)