Skip to content
This repository has been archived by the owner on Dec 7, 2018. It is now read-only.

Commit

Permalink
Synchronize redis operations with task-aware latch.
Browse files Browse the repository at this point in the history
  • Loading branch information
marshall-lee committed Aug 21, 2015
1 parent bd7451d commit 2b0508e
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions lib/celluloid/redis.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
require "redis"

require "celluloid/redis/version"
require "celluloid/io"

module Celluloid
class Redis < ::Redis
VERSION = CelluloidRedis::VERSION

def synchronize
if @options[:driver] == :celluloid
@latch ||= Celluloid::IO::Stream::Latch.new
@latch.synchronize { yield @client }
else
super(&proc)
end
end
end
end

0 comments on commit 2b0508e

Please sign in to comment.