Skip to content

Redic::Pool#commit fails if the queue is empty #7

@mwpastore

Description

@mwpastore

The commit method fails with a NoMethodError on nil if the queue is empty. This is because Thread.current[@id] never gets initialized. Here's a quick fix:

class Redic::Pool
  # https://github.com/djanowski/redic-pool/issues/7
  alias_method :unsafe_commit, :commit

  def commit
    Thread.current[@id] || (Thread.current[@id] = [])

    unsafe_commit
  end
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions