perfectqueue 0.7.16 → 0.7.17

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog CHANGED
@@ -1,4 +1,9 @@
1
1
 
2
+ == 2012-01-10 version 0.7.17
3
+
4
+ * RDBBackend: disabled connection keepalive
5
+
6
+
2
7
  == 2012-01-10 version 0.7.16
3
8
 
4
9
  * RDBBackend: sleep 0.5 before retrying failed transaction by deadlock
@@ -8,7 +8,7 @@ class RDBBackend < Backend
8
8
  @uri = uri
9
9
  @table = table
10
10
  @db = Sequel.connect(@uri, :max_connections=>1)
11
- @last_time = Time.now.to_i
11
+ #@last_time = Time.now.to_i
12
12
  @mutex = Mutex.new
13
13
  #init_db(@uri.split('//',2)[0])
14
14
  connect {
@@ -51,12 +51,12 @@ SQL
51
51
 
52
52
  private
53
53
  def connect(&block)
54
- now = Time.now.to_i
54
+ #now = Time.now.to_i
55
55
  @mutex.synchronize do
56
- if now - @last_time > KEEPALIVE
57
- @db.disconnect
58
- end
59
- @last_time = now
56
+ #if now - @last_time > KEEPALIVE
57
+ # @db.disconnect
58
+ #end
59
+ #@last_time = now
60
60
  retry_count = 0
61
61
  begin
62
62
  block.call
@@ -74,6 +74,8 @@ SQL
74
74
  end
75
75
  end
76
76
  raise
77
+ ensure
78
+ @db.disconnect
77
79
  end
78
80
  end
79
81
  end
@@ -87,7 +89,7 @@ SQL
87
89
 
88
90
  MAX_SELECT_ROW = 8
89
91
  MAX_RESOURCE = (ENV['PQ_MAX_RESOURCE'] || 4).to_i
90
- KEEPALIVE = 10
92
+ #KEEPALIVE = 10
91
93
  MAX_RETRY = 10
92
94
 
93
95
  def acquire(timeout, now=Time.now.to_i)
@@ -1,5 +1,5 @@
1
1
  module PerfectQueue
2
2
 
3
- VERSION = '0.7.16'
3
+ VERSION = '0.7.17'
4
4
 
5
5
  end
data/test/stress.rb CHANGED
@@ -25,7 +25,7 @@ class StressTest
25
25
  @num.times {|i|
26
26
  now = Time.now.to_i
27
27
  @db.submit("#{@key_prefix}-#{i}", "data", now)
28
- token, task = @db.acquire(now+60)
28
+ token, task = @db.acquire(now+60, now)
29
29
  if token == nil
30
30
  puts "acquire failed"
31
31
  next
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: perfectqueue
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.16
4
+ version: 0.7.17
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-01-11 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sequel
16
- requirement: &13164680 !ruby/object:Gem::Requirement
16
+ requirement: &17699280 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 3.26.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *13164680
24
+ version_requirements: *17699280
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: aws-sdk
27
- requirement: &13164120 !ruby/object:Gem::Requirement
27
+ requirement: &17698600 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: 1.1.1
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *13164120
35
+ version_requirements: *17698600
36
36
  description:
37
37
  email: frsyuki@gmail.com
38
38
  executables: