redis_ha 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/redis_ha/connection.rb +3 -4
- data/lib/redis_ha/connection_pool.rb +1 -1
- data/lib/test.rb +2 -2
- data/redis_ha.gemspec +1 -1
- metadata +3 -3
data/lib/redis_ha/connection.rb
CHANGED
@@ -16,7 +16,8 @@ class RedisHA::Connection < Socket
|
|
16
16
|
def yield_connect
|
17
17
|
if @redis[:db] && !@db_selected
|
18
18
|
@db_selected = true
|
19
|
-
|
19
|
+
@response_offset += 1
|
20
|
+
self << RedisHA::Protocol.request("select", @redis[:db])
|
20
21
|
end
|
21
22
|
|
22
23
|
connect_nonblock(@__addr)
|
@@ -48,14 +49,12 @@ class RedisHA::Connection < Socket
|
|
48
49
|
end
|
49
50
|
|
50
51
|
def <<(buf)
|
51
|
-
@response_offset += 1
|
52
52
|
@write_buffer << buf
|
53
53
|
end
|
54
54
|
|
55
55
|
def rewind
|
56
|
-
@read_buffer = ""
|
57
56
|
@ready = false
|
58
|
-
@response_offset
|
57
|
+
@response_offset -= 0
|
59
58
|
end
|
60
59
|
|
61
60
|
def next
|
@@ -8,7 +8,7 @@ class RedisHA::ConnectionPool
|
|
8
8
|
# the default is 5s
|
9
9
|
DEFAULT_RETRY_TIMEOUT = 5
|
10
10
|
|
11
|
-
attr_accessor :
|
11
|
+
attr_accessor :connections, :read_timeout, :retry_timeout
|
12
12
|
|
13
13
|
def initialize
|
14
14
|
@read_timeout = DEFAULT_READ_TIMEOUT
|
data/lib/test.rb
CHANGED
@@ -15,7 +15,7 @@ require "redis_ha"
|
|
15
15
|
|
16
16
|
pool = RedisHA::ConnectionPool.new
|
17
17
|
pool.retry_timeout = 0.5
|
18
|
-
pool.read_timeout =
|
18
|
+
pool.read_timeout = 0.1
|
19
19
|
pool.connect(
|
20
20
|
{:host => "localhost", :port => 6379, :db => 2},
|
21
21
|
{:host => "127.0.0.1", :port => 6380, :db => 2})
|
@@ -28,7 +28,7 @@ pool.connect(
|
|
28
28
|
#puts pool.smembers("fnordset").inspect
|
29
29
|
#puts set.get.inspect
|
30
30
|
|
31
|
-
puts pool.ping.inspect
|
31
|
+
10.times{ puts pool.ping.inspect }
|
32
32
|
exit
|
33
33
|
|
34
34
|
Ripl.start :binding => binding
|
data/redis_ha.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redis_ha
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-12-27 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: redis
|
16
|
-
requirement: &
|
16
|
+
requirement: &20066220 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: 2.2.2
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *20066220
|
25
25
|
description: Three basic CRDTs (set, hashmap and counter) for redis. Also includes
|
26
26
|
a ConnectionPool that allows you to run concurrent redis commands on multiple connections
|
27
27
|
w/o using eventmachine/em-hiredis.
|