distributed_mutex 1.1.6 → 1.1.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/Gemfile +1 -1
  2. data/Gemfile.lock +1 -1
  3. data/VERSION +1 -1
  4. data/lib/mysql_mutex.rb +6 -4
  5. metadata +23 -16
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
1
  source :rubygems
2
2
 
3
- gem 'activerecord', '>= 2.3'
3
+ gem 'activerecord', '>= 2.3', '<3.0'
4
4
  gem 'mysql'
5
5
 
6
6
  group :development do
data/Gemfile.lock CHANGED
@@ -25,7 +25,7 @@ PLATFORMS
25
25
  ruby
26
26
 
27
27
  DEPENDENCIES
28
- activerecord (>= 2.3)
28
+ activerecord (>= 2.3, < 3.0)
29
29
  jeweler
30
30
  mysql
31
31
  rspec
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.6
1
+ 1.1.7
data/lib/mysql_mutex.rb CHANGED
@@ -7,10 +7,12 @@ class MySQLMutex < DistributedMutex
7
7
 
8
8
  def initialize(key, timeout = DEFAULT_TIMEOUT, exception_on_timeout = DEFAULT_EXCEPTION_ON_TIMEOUT, connection = ActiveRecord::Base.connection)
9
9
  super(key, timeout, exception_on_timeout)
10
- @connection = connection
11
- @connection_id = connection.show_variable('pseudo_thread_id')
12
- @get_sql = ActiveRecord::Base.send(:sanitize_sql_array,["SELECT GET_LOCK(?,?)", key, timeout])
13
- @release_sql = ActiveRecord::Base.send(:sanitize_sql_array,["SELECT RELEASE_LOCK(?)", key])
10
+ sanitized_key = connection.quote(key)
11
+ sanitized_timeout = connection.quote(timeout)
12
+ @connection = connection
13
+ @connection_id = connection.show_variable('pseudo_thread_id')
14
+ @get_sql = "SELECT GET_LOCK(#{sanitized_key},#{sanitized_timeout})"
15
+ @release_sql = "SELECT RELEASE_LOCK(#{sanitized_key})"
14
16
  end
15
17
 
16
18
  def self.synchronize(key, timeout = DEFAULT_TIMEOUT, exception_on_timeout = DEFAULT_TIMEOUT, con = ActiveRecord::Base.connection, &block)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: distributed_mutex
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 1
9
- - 6
10
- version: 1.1.6
9
+ - 7
10
+ version: 1.1.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - Birkir A. Barkarson
@@ -15,13 +15,13 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-01-17 00:00:00 +09:00
18
+ date: 2012-11-01 00:00:00 +09:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
- name: activerecord
23
22
  prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
23
+ name: activerecord
24
+ version_requirements: &id001 !ruby/object:Gem::Requirement
25
25
  none: false
26
26
  requirements:
27
27
  - - ">="
@@ -31,12 +31,19 @@ dependencies:
31
31
  - 2
32
32
  - 3
33
33
  version: "2.3"
34
+ - - <
35
+ - !ruby/object:Gem::Version
36
+ hash: 7
37
+ segments:
38
+ - 3
39
+ - 0
40
+ version: "3.0"
41
+ requirement: *id001
34
42
  type: :runtime
35
- version_requirements: *id001
36
43
  - !ruby/object:Gem::Dependency
37
- name: mysql
38
44
  prerelease: false
39
- requirement: &id002 !ruby/object:Gem::Requirement
45
+ name: mysql
46
+ version_requirements: &id002 !ruby/object:Gem::Requirement
40
47
  none: false
41
48
  requirements:
42
49
  - - ">="
@@ -45,12 +52,12 @@ dependencies:
45
52
  segments:
46
53
  - 0
47
54
  version: "0"
55
+ requirement: *id002
48
56
  type: :runtime
49
- version_requirements: *id002
50
57
  - !ruby/object:Gem::Dependency
51
- name: jeweler
52
58
  prerelease: false
53
- requirement: &id003 !ruby/object:Gem::Requirement
59
+ name: jeweler
60
+ version_requirements: &id003 !ruby/object:Gem::Requirement
54
61
  none: false
55
62
  requirements:
56
63
  - - ">="
@@ -59,12 +66,12 @@ dependencies:
59
66
  segments:
60
67
  - 0
61
68
  version: "0"
69
+ requirement: *id003
62
70
  type: :development
63
- version_requirements: *id003
64
71
  - !ruby/object:Gem::Dependency
65
- name: rspec
66
72
  prerelease: false
67
- requirement: &id004 !ruby/object:Gem::Requirement
73
+ name: rspec
74
+ version_requirements: &id004 !ruby/object:Gem::Requirement
68
75
  none: false
69
76
  requirements:
70
77
  - - ">="
@@ -73,8 +80,8 @@ dependencies:
73
80
  segments:
74
81
  - 0
75
82
  version: "0"
83
+ requirement: *id004
76
84
  type: :development
77
- version_requirements: *id004
78
85
  description: Framework for using a distributed mutex along with an implementation of a mutex stored on a MySQL database.
79
86
  email: birkirb@stoicviking.net
80
87
  executables: []