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

Commit 2b0508e

Browse files
committed
Synchronize redis operations with task-aware latch.
1 parent bd7451d commit 2b0508e

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

lib/celluloid/redis.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
11
require "redis"
22

33
require "celluloid/redis/version"
4+
require "celluloid/io"
5+
6+
module Celluloid
7+
class Redis < ::Redis
8+
VERSION = CelluloidRedis::VERSION
9+
10+
def synchronize
11+
if @options[:driver] == :celluloid
12+
@latch ||= Celluloid::IO::Stream::Latch.new
13+
@latch.synchronize { yield @client }
14+
else
15+
super(&proc)
16+
end
17+
end
18+
end
19+
end

0 commit comments

Comments
 (0)