redis_ha 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  class RedisHA::Connection < Thread
2
2
 
3
- POLL_INTERVAL = 0.00001
3
+ POLL_INTERVAL = 0.01
4
4
 
5
5
  attr_accessor :status, :buffer
6
6
 
@@ -12,8 +12,9 @@ class RedisHA::Connection < Thread
12
12
  @redis_opts = redis_opts
13
13
 
14
14
  @queue = Array.new
15
+ @queue_lock = Mutex.new
15
16
  @buffer = Array.new
16
- @lock = Mutex.new
17
+ @buffer_lock = Mutex.new
17
18
 
18
19
  super do
19
20
  run
@@ -21,13 +22,13 @@ class RedisHA::Connection < Thread
21
22
  end
22
23
 
23
24
  def next
24
- @lock.synchronize do
25
+ @buffer_lock.synchronize do
25
26
  @buffer.shift
26
27
  end
27
28
  end
28
29
 
29
30
  def <<(msg)
30
- @lock.synchronize do
31
+ @buffer_lock.synchronize do
31
32
  @queue << msg
32
33
  end
33
34
  end
@@ -38,7 +39,7 @@ private
38
39
  while job = pop
39
40
  semaphore, *msg = job
40
41
 
41
- @lock.synchronize do
42
+ @buffer_lock.synchronize do
42
43
  @buffer << send(*msg)
43
44
  end
44
45
 
@@ -49,7 +50,7 @@ private
49
50
  def pop
50
51
  loop do
51
52
  sleep(POLL_INTERVAL) while @queue.size < 1
52
- @lock.synchronize do
53
+ @queue_lock.synchronize do
53
54
  job = @queue.shift
54
55
  return job if job
55
56
  end
@@ -1,6 +1,6 @@
1
1
  class RedisHA::Semaphore
2
2
 
3
- POLL_INTERVAL = 0.00001
3
+ POLL_INTERVAL = 0.001
4
4
 
5
5
  def initialize(n)
6
6
  @lock = Mutex.new
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "redis_ha"
6
- s.version = "0.0.4"
6
+ s.version = "0.0.5"
7
7
  s.date = Date.today.to_s
8
8
  s.platform = Gem::Platform::RUBY
9
9
  s.authors = ["Paul Asmuth"]
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.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-11-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: redis
16
- requirement: &13405180 !ruby/object:Gem::Requirement
16
+ requirement: &9331680 !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: *13405180
24
+ version_requirements: *9331680
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.