Skip to content

Commit

Permalink
If a Redis lock is deleted between SETNX and GET, do nothing since it…
Browse files Browse the repository at this point in the history
…'s probably caused by another process having just finished doing GC.
  • Loading branch information
jcoglan committed Sep 22, 2011
1 parent a66ff17 commit 92fc39d
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
2 changes: 1 addition & 1 deletion javascript/engines/redis.js
Expand Up @@ -176,7 +176,7 @@ Faye.Engine.Redis = Faye.Class(Faye.Engine.Base, {
if (set === 1) return callback.call(scope, releaseLock);

self._redis.get(lockKey, function(error, timeout) {
if (!timeout) return self._withLock(lockKey, callback, scope);
if (!timeout) return;

var lockTimeout = parseInt(timeout, 10);
if (currentTime < lockTimeout) return;
Expand Down
2 changes: 0 additions & 2 deletions lib/faye/engines/redis.rb
Expand Up @@ -192,8 +192,6 @@ def with_lock(lock_name, &block)
block.call(release_lock) if old_value == timeout
end
end
else
with_lock(lock_name, &block)
end
end

Expand Down

0 comments on commit 92fc39d

Please sign in to comment.