diff --git a/lib/redis_client/cluster/optimistic_locking.rb b/lib/redis_client/cluster/optimistic_locking.rb index 4f11d6f..8db9a9d 100644 --- a/lib/redis_client/cluster/optimistic_locking.rb +++ b/lib/redis_client/cluster/optimistic_locking.rb @@ -18,9 +18,10 @@ def watch(keys) @router.handle_redirection(node, retry_count: 1) do |nd| nd.with do |c| c.call('WATCH', *keys) - reply = yield(c, slot) + yield(c, slot) + rescue StandardError c.call('UNWATCH') - reply + raise end end end