def unlock
      EM.cancel_timer(@expire_timer) if @expire_timer

      df = EM::DefaultDeferrable.new
      @redis.lock_release([@key], [@token]).callback { |keys_removed|
        if keys_removed > 0
          EM::Hiredis.logger.debug "#{to_s} released"
          df.succeed
        else
          EM::Hiredis.logger.debug "#{to_s} could not release, not held"
          df.fail("Cannot release a lock we do not hold")
        end
      }.errback { |e|
        EM::Hiredis.logger.error "#{to_s} Error releasing lock #{e}"
        df.fail(e)
      }
      df
    end
def unlock
      EM.cancel_timer(@expire_timer) if @expire_timer

      df = EM::DefaultDeferrable.new
      @redis.lock_release([@key], [@token]).callback { |keys_removed|
        if keys_removed > 0
          EM::Hiredis.logger.debug "
          df.succeed
        else
          EM::Hiredis.logger.debug "
          df.fail("Cannot release a lock we do not hold")
        end
      }.errback { |e|
        EM::Hiredis.logger.error "
        df.fail(e)
      }
      df
    end
def unlock EM . cancel_timer ( @expire_timer ) if @expire_timer df = EM :: DefaultDeferrable . new @redis . lock_release ( [ @key ] , [ @token ] ) . callback { | keys_removed | if keys_removed > 0 EM :: Hiredis . logger . debug "#{to_s} released" df . succeed else EM :: Hiredis . logger . debug "#{to_s} could not release, not held" df . fail ( "Cannot release a lock we do not hold" ) end } . errback { | e | EM :: Hiredis . logger . error "#{to_s} Error releasing lock #{e}" df . fail ( e ) } df end
Release the lock

 Returns a deferrable
Release the lock