with_advisory_lock 3.0.0 → 4.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: aeb99a0ddec77a51eeb59a41a26411a25390c65b
4
- data.tar.gz: 3ee6f67835cbd6f3fe515f41b8134478ef2102ce
2
+ SHA256:
3
+ metadata.gz: bc4719c3f44e4cf1f219b582d21cf9757274ca1fcca6128c227798f32d4b589e
4
+ data.tar.gz: c63b8be1ee91b25a519b5a4d7d090ff98172d6d3a476899b55c6cd03bf77eda6
5
5
  SHA512:
6
- metadata.gz: 58919a4b30f793b056f8c9f2af7f06f40673f5e9e6ef68213760f49b348f9044087ab16a1b398619e7c47bcba14db7eecadaf50a6f5652bfa5e36bb0ef1d9fc7
7
- data.tar.gz: a819c9b4d0c2607505b90f9dbb8f981c041c3608ae69a63e7dac621d105479be268b5d425f1ec946c225b36175d595ed2115782a9a239cd3ad671c6e3b25d665
6
+ metadata.gz: be5a906b9740506447bfcdb1928cd5473add67e0a48acd32f8a26ca4671be49b34ca5eca987df2f8e6f29a0a3dbb0bccc3321061d9f1e5827a0ca4ef44341124
7
+ data.tar.gz: 124358b251ffd9cc066d54aebfeeca97fb0db88ae18293fb7e0169ceb13960d298e72c66e9d5fbd79f0cbda5360d2fdb2e609866ac82eeb26b1eab6ead103daf
data/.gitignore CHANGED
@@ -1,5 +1,6 @@
1
1
  *.gem
2
2
  *.rbc
3
+ *.history
3
4
  *.idea
4
5
  .bundle
5
6
  .config
@@ -16,3 +17,4 @@ spec/reports
16
17
  test/tmp
17
18
  test/version_tmp
18
19
  tmp
20
+ *.iml
data/.tool-versions ADDED
@@ -0,0 +1 @@
1
+ ruby 2.6.4
data/.travis.yml CHANGED
@@ -1,31 +1,38 @@
1
1
  language: ruby
2
2
 
3
+ services:
4
+ - postgresql
5
+ - mysql
6
+
7
+ addons:
8
+ postgresql: "10"
9
+
3
10
  rvm:
4
- - jruby-19mode
5
- - 2.1.2
6
- - 1.9.3
7
- # TODO - rbx-2
11
+ - 2.6.4
12
+ - 2.5.6
13
+ - 2.4.7
8
14
 
9
15
  gemfile:
10
- - gemfiles/activerecord_3.2.gemfile
11
- - gemfiles/activerecord_4.0.gemfile
12
- - gemfiles/activerecord_4.1.gemfile
13
- - gemfiles/activerecord_edge.gemfile
16
+ - gemfiles/activerecord_6.0.gemfile
17
+ - gemfiles/activerecord_5.2.gemfile
18
+ - gemfiles/activerecord_5.1.gemfile
19
+ - gemfiles/activerecord_5.0.gemfile
20
+ - gemfiles/activerecord_4.2.gemfile
14
21
 
15
22
  env:
16
- - DB=sqlite
17
- - DB=mysql
18
- - DB=postgresql
19
-
20
- script: WITH_ADVISORY_LOCK_PREFIX=$TRAVIS_JOB_ID bundle exec rake --trace
23
+ global:
24
+ - WITH_ADVISORY_LOCK_PREFIX=$TRAVIS_JOB_ID
25
+ matrix:
26
+ - DB=postgresql
27
+ - DB=mysql MYSQL_VERSION=5.7
28
+ - DB=sqlite
29
+ matrix:
30
+ exclude:
31
+ - rvm: 2.4.7
32
+ gemfile: gemfiles/activerecord_6.0.gemfile
21
33
 
22
- before_script:
34
+ before_install:
23
35
  - mysql -e 'create database with_advisory_lock_test'
24
36
  - psql -c 'create database with_advisory_lock_test' -U postgres
25
37
 
26
- matrix:
27
- allow_failures:
28
- - gemfile: gemfiles/activerecord_edge.gemfile
29
- - rvm: jruby-19mode # travis' version of jruby has issues. Tests pass with jruby 1.7.13/java 1.8.0_11 on mac.
30
- - rvm: rbx-2
31
-
38
+ script: bundle exec rake --trace
data/Appraisals CHANGED
@@ -1,16 +1,29 @@
1
- appraise "activerecord-3.2" do
2
- gem 'activerecord', '~> 3.2.0'
1
+ appraise "activerecord-4.2" do
2
+ gem "activerecord", "~> 4.2.0"
3
+ platforms :ruby do
4
+ gem "pg", "~> 0.21"
5
+ gem "mysql2", "< 0.5"
6
+ gem "sqlite3", "~> 1.3.6"
7
+ end
3
8
  end
4
9
 
5
- appraise "activerecord-4.0" do
6
- gem "activerecord", "~> 4.0.0"
10
+ appraise "activerecord-5.0" do
11
+ gem "activerecord", "~> 5.0.0"
12
+ platforms :ruby do
13
+ gem "sqlite3", "~> 1.3.6"
14
+ end
7
15
  end
8
16
 
9
- appraise "activerecord-4.1" do
10
- gem "activerecord", "~> 4.1.0"
17
+ appraise "activerecord-5.1" do
18
+ gem "activerecord", "~> 5.1.0"
19
+ gem "sqlite3", "~> 1.3.6"
11
20
  end
12
21
 
13
- appraise "activerecord-edge" do
14
- gem "activerecord", github: "rails/rails"
15
- gem 'arel', github: 'rails/arel'
22
+ appraise "activerecord-5.2" do
23
+ gem "activerecord", "~> 5.1.0"
24
+ gem "sqlite3", "~> 1.3.6"
25
+ end
26
+
27
+ appraise "activerecord-6.0" do
28
+ gem "activerecord", "~> 6.0.0"
16
29
  end
data/CHANGELOG.md ADDED
@@ -0,0 +1,122 @@
1
+ ## Changelog
2
+
3
+ ### 4.6.0
4
+
5
+ - Support for ActiveRecord 6
6
+ - Add Support for nested locks in MySQL
7
+
8
+ ### 4.0.0
9
+
10
+ - Drop support for unsupported versions of activerecord
11
+ - Drop support for unsupported versions of ruby
12
+
13
+ ### 3.2.0
14
+
15
+ - [Joshua Flanagan](https://github.com/joshuaflanagan) [added a SQL comment to the lock query for PostgreSQL](https://github.com/ClosureTree/with_advisory_lock/pull/28). Thanks!
16
+ - [Fernando Luizão](https://github.com/fernandoluizao) found a spurious requirement for `thread_safe`. Thanks for the [fix](https://github.com/ClosureTree/with_advisory_lock/pull/27)!
17
+
18
+ ### 3.1.1
19
+
20
+ - [Joel Turkel](https://github.com/jturkel) added `require 'active_support'` (it was required, but relied on downstream gems to pull in active_support before pulling in with_advisory_lock). Thanks!
21
+
22
+ ### 3.1.0
23
+
24
+ - [Jason Weathered](https://github.com/jasoncodes) Added new shared and transaction-level lock options ([Pull request 21](https://github.com/ClosureTree/with_advisory_lock/pull/21)). Thanks!
25
+ - Added ActiveRecord 5.0 to build matrix. Dropped 3.2, 4.0, and 4.1 (which no longer get security updates: http://rubyonrails.org/security/)
26
+ - Replaced ruby 1.9 and 2.0 (both EOL) with ruby 2.2 and 2.3 (see https://www.ruby-lang.org/en/downloads/)
27
+
28
+ ### 3.0.0
29
+
30
+ - Added jruby/PostgreSQL support for Rails 4.x
31
+ - Reworked threaded tests to allow jruby tests to pass
32
+
33
+ #### API changes
34
+
35
+ - `yield_with_lock_and_timeout` and `yield_with_lock` now return instances of
36
+ `WithAdvisoryLock::Result`, so blocks that return `false` are not misinterpreted
37
+ as a failure to lock. As this changes the interface (albeit internal methods), the major version
38
+ number was incremented.
39
+ - `with_advisory_lock_result` was introduced, which clarifies whether the lock was acquired
40
+ versus the yielded block returned false.
41
+
42
+ ### 2.0.0
43
+
44
+ - Lock timeouts of 0 now attempt the lock once, as per suggested by
45
+ [Jon Leighton](https://github.com/jonleighton) and implemented by
46
+ [Abdelkader Boudih](https://github.com/seuros). Thanks to both of you!
47
+ - [Pull request 11](https://github.com/ClosureTree/with_advisory_lock/pull/11)
48
+ fixed a downstream issue with jruby support! Thanks, [Aaron Todd](https://github.com/ozzyaaron)!
49
+ - Added Travis tests for jruby
50
+ - Dropped support for Rails 3.0, 3.1, and Ruby 1.8.7, as they are no longer
51
+ receiving security patches. See http://rubyonrails.org/security/ for more information.
52
+ This required the major version bump.
53
+ - Refactored `advisory_lock_exists?` to use existing functionality
54
+ - Fixed sqlite's implementation so parallel tests could be run against it
55
+
56
+ ### 1.0.0
57
+
58
+ - Releasing 1.0.0. The interface will be stable.
59
+ - Added `advisory_lock_exists?`. Thanks, [Sean Devine](https://github.com/barelyknown), for the
60
+ great pull request!
61
+ - Added Travis test for Rails 4.1
62
+
63
+ ### 0.0.10
64
+
65
+ - Explicitly added MIT licensing to the gemspec.
66
+
67
+ ### 0.0.9
68
+
69
+ - Merged in Postgis Adapter Support to address [issue 7](https://github.com/ClosureTree/with_advisory_lock/issues/7)
70
+ Thanks for the pull request, [Abdelkader Boudih](https://github.com/seuros)!
71
+ - The database switching code had to be duplicated by [Closure Tree](https://github.com/ClosureTree/closure_tree),
72
+ so I extracted a new `WithAdvisoryLock::DatabaseAdapterSupport` one-trick pony.
73
+ - Builds were failing on Travis, so I introduced a global lock prefix that can be set with the
74
+ `WITH_ADVISORY_LOCK_PREFIX` environment variable. I'm not going to advertise this feature yet.
75
+ It's a secret. Only you and I know, now. _shhh_
76
+
77
+ ### 0.0.8
78
+
79
+ - Addressed [issue 5](https://github.com/ClosureTree/with_advisory_lock/issues/5) by
80
+ using a deterministic hash for Postgresql + MRI >= 1.9.
81
+ Thanks for the pull request, [Joel Turkel](https://github.com/jturkel)!
82
+ - Addressed [issue 2](https://github.com/ClosureTree/with_advisory_lock/issues/2) by
83
+ using a cache-busting query for MySQL and Postgres to deal with AR value caching bug.
84
+ Thanks for the pull request, [Jaime Giraldo](https://github.com/sposmen)!
85
+ - Addressed [issue 4](https://github.com/ClosureTree/with_advisory_lock/issues/4) by
86
+ adding support for `em-postgresql-adapter`.
87
+ Thanks, [lestercsp](https://github.com/lestercsp)!
88
+
89
+ (Hey, github—your notifications are WAY too easy to ignore!)
90
+
91
+ ### 0.0.7
92
+
93
+ - Added Travis tests for Rails 3.0, 3.1, 3.2, and 4.0
94
+ - Fixed MySQL bug with select_value returning a string instead of an integer when using AR 3.0.x
95
+
96
+ ### 0.0.6
97
+
98
+ - Only require ActiveRecord >= 3.0.x
99
+ - Fixed MySQL error reporting
100
+
101
+ ### 0.0.5
102
+
103
+ - Asking for the currently acquired advisory lock doesn't re-ask for the lock now.
104
+ - Introduced NestedAdvisoryLockError when asking for different, nested advisory locksMySQL
105
+
106
+ ### 0.0.4
107
+
108
+ - Moved require into on_load, which should speed loading when AR doesn't have to spin up
109
+
110
+ ### 0.0.3
111
+
112
+ - Fought with ActiveRecord 3.0.x and 3.1.x. You don't want them if you use threads—they fail
113
+ predictably.
114
+
115
+ ### 0.0.2
116
+
117
+ - Added warning log message for nested MySQL lock calls
118
+ - Randomized lock wait time, which can help ameliorate lock contention
119
+
120
+ ### 0.0.1
121
+
122
+ - First whack
data/README.md CHANGED
@@ -1,24 +1,27 @@
1
1
  # with_advisory_lock
2
2
 
3
- Adds advisory locking (mutexes) to ActiveRecord 3.2, 4.0 and 4.1 when used with
4
- [MySQL](http://dev.mysql.com/doc/refman/5.0/en/miscellaneous-functions.html#function_get-lock)
5
- or [PostgreSQL](http://www.postgresql.org/docs/9.3/static/functions-admin.html#FUNCTIONS-ADVISORY-LOCKS).
3
+ Adds advisory locking (mutexes) to ActiveRecord 4.2, 5.x and 6.0, with ruby
4
+ 2.4, 2.5 and 2.6, when used with
5
+ [MySQL](https://dev.mysql.com/doc/refman/8.0/en/miscellaneous-functions.html#function_get-lock)
6
+ or
7
+ [PostgreSQL](https://www.postgresql.org/docs/current/static/functions-admin.html#FUNCTIONS-ADVISORY-LOCKS).
6
8
  SQLite resorts to file locking.
7
9
 
8
- [![Build Status](https://api.travis-ci.org/mceachen/with_advisory_lock.png?branch=master)](https://travis-ci.org/mceachen/with_advisory_lock)
9
- [![Gem Version](https://badge.fury.io/rb/with_advisory_lock.png)](http://rubygems.org/gems/with_advisory_lock)
10
- [![Code Climate](https://codeclimate.com/github/mceachen/with_advisory_lock.png)](https://codeclimate.com/github/mceachen/with_advisory_lock)
11
- [![Dependency Status](https://gemnasium.com/mceachen/with_advisory_lock.png)](https://gemnasium.com/mceachen/with_advisory_lock)
10
+ [![Build Status](https://api.travis-ci.org/ClosureTree/with_advisory_lock.svg?branch=master)](https://travis-ci.org/ClosureTree/with_advisory_lock)
11
+ [![Gem Version](https://badge.fury.io/rb/with_advisory_lock.svg)](https://badge.fury.io/rb/with_advisory_lock)
12
12
 
13
13
  ## What's an "Advisory Lock"?
14
14
 
15
- An advisory lock is a [mutex](http://en.wikipedia.org/wiki/Mutual_exclusion) used to ensure no two
16
- processes run some process at the same time. When the advisory lock is powered by your database
17
- server, as long as it isn't SQLite, your mutex spans hosts.
15
+ An advisory lock is a [mutex](https://en.wikipedia.org/wiki/Mutual_exclusion)
16
+ used to ensure no two processes run some process at the same time. When the
17
+ advisory lock is powered by your database server, as long as it isn't SQLite,
18
+ your mutex spans hosts.
18
19
 
19
20
  ## Usage
20
21
 
21
- Where ```User``` is an ActiveRecord model, and ```lock_name``` is some string:
22
+ This gem automatically includes the `WithAdvisoryLock` module in all of your
23
+ ActiveRecord models. Here's an example of how to use it where `User` is an
24
+ ActiveRecord model, and `lock_name` is some string:
22
25
 
23
26
  ```ruby
24
27
  User.with_advisory_lock(lock_name) do
@@ -34,41 +37,65 @@ end
34
37
 
35
38
  ### Lock wait timeouts
36
39
 
37
- The second parameter for ```with_advisory_lock``` is ```timeout_seconds```, and defaults to ```nil```,
38
- which means wait indefinitely for the lock.
40
+ `with_advisory_lock` takes an options hash as the second parameter. The
41
+ `timeout_seconds` option defaults to `nil`, which means wait indefinitely for
42
+ the lock.
39
43
 
40
44
  A value of zero will try the lock only once. If the lock is acquired, the block
41
- will be yielded to. If the lock is currently being held, the block will not be called.
45
+ will be yielded to. If the lock is currently being held, the block will not be
46
+ called.
42
47
 
43
- Note that if a non-nil value is provided for `timeout_seconds`, the block will not be invoked if
44
- the lock cannot be acquired within that time-frame.
48
+ Note that if a non-nil value is provided for `timeout_seconds`, the block will
49
+ not be invoked if the lock cannot be acquired within that time-frame.
50
+
51
+ For backwards compatability, the timeout value can be specified directly as the
52
+ second parameter.
53
+
54
+ ### Shared locks
55
+
56
+ The `shared` option defaults to `false` which means an exclusive lock will be
57
+ obtained. Setting `shared` to `true` will allow locks to be obtained by multiple
58
+ actors as long as they are all shared locks.
59
+
60
+ Note: MySQL does not support shared locks.
61
+
62
+ ### Transaction-level locks
63
+
64
+ PostgreSQL supports transaction-level locks which remain held until the
65
+ transaction completes. You can enable this by setting the `transaction` option
66
+ to `true`.
67
+
68
+ Note: transaction-level locks will not be reflected by `.current_advisory_lock`
69
+ when the block has returned.
45
70
 
46
71
  ### Return values
47
72
 
48
- The return value of `with_advisory_lock_result` is a `WithAdvisoryLock::Result` instance,
49
- which has a `lock_was_acquired?` method and a `result` accessor method, which is
50
- the returned value of the given block. If your block may validly return false, you should use
51
- this method.
52
-
53
- The return value of ```with_advisory_lock``` will be the result of the yielded block,
54
- if the lock was able to be acquired and the block yielded, or ```false```, if you provided
55
- a timeout_seconds value and the lock was not able to be acquired in time.
73
+ The return value of `with_advisory_lock_result` is a `WithAdvisoryLock::Result`
74
+ instance, which has a `lock_was_acquired?` method and a `result` accessor
75
+ method, which is the returned value of the given block. If your block may
76
+ validly return false, you should use this method.
77
+
78
+ The return value of `with_advisory_lock` will be the result of the yielded
79
+ block, if the lock was able to be acquired and the block yielded, or `false`, if
80
+ you provided a timeout_seconds value and the lock was not able to be acquired in
81
+ time.
56
82
 
57
83
  ### Testing for the current lock status
58
84
 
59
- If you needed to check if the advisory lock is currently being held, you can call
60
- ```Tag.advisory_lock_exists?("foo")```, but realize the lock can be acquired between the time you
61
- test for the lock, and the time you try to acquire the lock.
85
+ If you needed to check if the advisory lock is currently being held, you can
86
+ call `Tag.advisory_lock_exists?("foo")`, but realize the lock can be acquired
87
+ between the time you test for the lock, and the time you try to acquire the
88
+ lock.
62
89
 
63
- If you want to see if the current Thread is holding a lock, you can call ```Tag.current_advisory_lock```
64
- which will return the name of the current lock. If no lock is currently held,
65
- ```.current_advisory_lock``` returns ```nil```.
90
+ If you want to see if the current Thread is holding a lock, you can call
91
+ `Tag.current_advisory_lock` which will return the name of the current lock. If
92
+ no lock is currently held, `.current_advisory_lock` returns `nil`.
66
93
 
67
94
  ## Installation
68
95
 
69
96
  Add this line to your application's Gemfile:
70
97
 
71
- ``` ruby
98
+ ```ruby
72
99
  gem 'with_advisory_lock'
73
100
  ```
74
101
 
@@ -78,27 +105,31 @@ And then execute:
78
105
 
79
106
  ## Lock Types
80
107
 
81
- First off, know that there are **lots** of different kinds of locks available to you. **Pick the
82
- finest-grain lock that ensures correctness.** If you choose a lock that is too coarse, you are
83
- unnecessarily blocking other processes.
108
+ First off, know that there are **lots** of different kinds of locks available to
109
+ you. **Pick the finest-grain lock that ensures correctness.** If you choose a
110
+ lock that is too coarse, you are unnecessarily blocking other processes.
84
111
 
85
112
  ### Advisory locks
86
- These are named mutexes that are inherently "application level"—it is up to the application
87
- to acquire, run a critical code section, and release the advisory lock.
113
+
114
+ These are named mutexes that are inherently "application level"—it is up to the
115
+ application to acquire, run a critical code section, and release the advisory
116
+ lock.
88
117
 
89
118
  ### Row-level locks
119
+
90
120
  Whether [optimistic](http://api.rubyonrails.org/classes/ActiveRecord/Locking/Optimistic.html)
91
121
  or [pessimistic](http://api.rubyonrails.org/classes/ActiveRecord/Locking/Pessimistic.html),
92
122
  row-level locks prevent concurrent modification to a given model.
93
123
 
94
124
  **If you're building a
95
- [CRUD](http://en.wikipedia.org/wiki/Create,_read,_update_and_delete) application, this will be your
96
- most commonly used lock.**
125
+ [CRUD](http://en.wikipedia.org/wiki/Create,_read,_update_and_delete)
126
+ application, this will be your most commonly used lock.**
97
127
 
98
128
  ### Table-level locks
99
129
 
100
- Provided through something like the [monogamy](https://github.com/mceachen/monogamy)
101
- gem, these prevent concurrent access to **any instance of a model**. Their coarseness means they
130
+ Provided through something like the
131
+ [monogamy](https://github.com/ClosureTree/monogamy) gem, these prevent
132
+ concurrent access to **any instance of a model**. Their coarseness means they
102
133
  aren't going to be commonly applicable, and they can be a source of
103
134
  [deadlocks](http://en.wikipedia.org/wiki/Deadlock).
104
135
 
@@ -110,22 +141,31 @@ Advisory locks with MySQL and PostgreSQL ignore database transaction boundaries.
110
141
 
111
142
  You will want to wrap your block within a transaction to ensure consistency.
112
143
 
113
- ### MySQL doesn't support nesting
144
+ ### MySQL < 5.7.5 doesn't support nesting
114
145
 
115
- With MySQL (at least <= v5.5), if you ask for a *different* advisory lock within a ```with_advisory_lock``` block,
116
- you will be releasing the parent lock (!!!). A ```NestedAdvisoryLockError```will be raised
117
- in this case. If you ask for the same lock name, ```with_advisory_lock``` won't ask for the
118
- lock again, and the block given will be yielded to.
146
+ With MySQL < 5.7.5, if you ask for a _different_ advisory lock within
147
+ a `with_advisory_lock` block, you will be releasing the parent lock (!!!). A
148
+ `NestedAdvisoryLockError`will be raised in this case. If you ask for the same
149
+ lock name, `with_advisory_lock` won't ask for the lock again, and the block
150
+ given will be yielded to.
119
151
 
120
- ### There are many ```lock-*``` files in my project directory after test runs
152
+ This is not an issue in MySQL >= 5.7.5, and no error will be raised for nested
153
+ lock usage. You can override this by passing `force_nested_lock_support: true`
154
+ or `force_nested_lock_support: false` to the `with_advisory_lock` options.
155
+
156
+ ### Is clustered MySQL supported?
157
+
158
+ [No.](https://github.com/ClosureTree/with_advisory_lock/issues/16)
159
+
160
+ ### There are many `lock-*` files in my project directory after test runs
121
161
 
122
162
  This is expected if you aren't using MySQL or Postgresql for your tests.
123
- See [issue 3](https://github.com/mceachen/with_advisory_lock/issues/3).
163
+ See [issue 3](https://github.com/ClosureTree/with_advisory_lock/issues/3).
124
164
 
125
- SQLite doesn't have advisory locks, so we resort to file locking, which will only work
126
- if the ```FLOCK_DIR``` is set consistently for all ruby processes.
165
+ SQLite doesn't have advisory locks, so we resort to file locking, which will
166
+ only work if the `FLOCK_DIR` is set consistently for all ruby processes.
127
167
 
128
- In your ```spec_helper.rb``` or ```minitest_helper.rb```, add a ```before``` and ```after``` block:
168
+ In your `spec_helper.rb` or `minitest_helper.rb`, add a `before` and `after` block:
129
169
 
130
170
  ```ruby
131
171
  before do
@@ -136,101 +176,3 @@ after do
136
176
  FileUtils.remove_entry_secure ENV['FLOCK_DIR']
137
177
  end
138
178
  ```
139
-
140
- ## Changelog
141
-
142
- ### 3.0.0
143
-
144
- * Added jruby/PostgreSQL support for Rails 4.x
145
- * Reworked threaded tests to allow jruby tests to pass
146
-
147
- #### API changes
148
-
149
- * `yield_with_lock_and_timeout` and `yield_with_lock` now return instances of
150
- `WithAdvisoryLock::Result`, so blocks that return `false` are not misinterpreted
151
- as a failure to lock. As this changes the interface (albeit internal methods), the major version
152
- number was incremented.
153
- * `with_advisory_lock_result` was introduced, which clarifies whether the lock was acquired
154
- versus the yielded block returned false.
155
-
156
- ### 2.0.0
157
-
158
- * Lock timeouts of 0 now attempt the lock once, as per suggested by
159
- [Jon Leighton](https://github.com/jonleighton) and implemented by
160
- [Abdelkader Boudih](https://github.com/seuros). Thanks to both of you!
161
- * [Pull request 11](https://github.com/mceachen/with_advisory_lock/pull/11)
162
- fixed a downstream issue with jruby support! Thanks, [Aaron Todd](https://github.com/ozzyaaron)!
163
- * Added Travis tests for jruby
164
- * Dropped support for Rails 3.0, 3.1, and Ruby 1.8.7, as they are no longer
165
- receiving security patches. See http://rubyonrails.org/security/ for more information.
166
- This required the major version bump.
167
- * Refactored `advisory_lock_exists?` to use existing functionality
168
- * Fixed sqlite's implementation so parallel tests could be run against it
169
-
170
- ### 1.0.0
171
-
172
- * Releasing 1.0.0. The interface will be stable.
173
- * Added ```advisory_lock_exists?```. Thanks, [Sean Devine](https://github.com/barelyknown), for the
174
- great pull request!
175
- * Added Travis test for Rails 4.1
176
-
177
- ### 0.0.10
178
-
179
- * Explicitly added MIT licensing to the gemspec.
180
-
181
- ### 0.0.9
182
-
183
- * Merged in Postgis Adapter Support to address [issue 7](https://github.com/mceachen/with_advisory_lock/issues/7)
184
- Thanks for the pull request, [Abdelkader Boudih](https://github.com/seuros)!
185
- * The database switching code had to be duplicated by [Closure Tree](https://github.com/mceachen/closure_tree),
186
- so I extracted a new ```WithAdvisoryLock::DatabaseAdapterSupport``` one-trick pony.
187
- * Builds were failing on Travis, so I introduced a global lock prefix that can be set with the
188
- ```WITH_ADVISORY_LOCK_PREFIX``` environment variable. I'm not going to advertise this feature yet.
189
- It's a secret. Only you and I know, now. *shhh*
190
-
191
- ### 0.0.8
192
-
193
- * Addressed [issue 5](https://github.com/mceachen/with_advisory_lock/issues/5) by
194
- using a deterministic hash for Postgresql + MRI >= 1.9.
195
- Thanks for the pull request, [Joel Turkel](https://github.com/jturkel)!
196
- * Addressed [issue 2](https://github.com/mceachen/with_advisory_lock/issues/2) by
197
- using a cache-busting query for MySQL and Postgres to deal with AR value caching bug.
198
- Thanks for the pull request, [Jaime Giraldo](https://github.com/sposmen)!
199
- * Addressed [issue 4](https://github.com/mceachen/with_advisory_lock/issues/4) by
200
- adding support for ```em-postgresql-adapter```.
201
- Thanks, [lestercsp](https://github.com/lestercsp)!
202
-
203
- (Hey, github—your notifications are WAY too easy to ignore!)
204
-
205
- ### 0.0.7
206
-
207
- * Added Travis tests for Rails 3.0, 3.1, 3.2, and 4.0
208
- * Fixed MySQL bug with select_value returning a string instead of an integer when using AR 3.0.x
209
-
210
- ### 0.0.6
211
-
212
- * Only require ActiveRecord >= 3.0.x
213
- * Fixed MySQL error reporting
214
-
215
- ### 0.0.5
216
-
217
- * Asking for the currently acquired advisory lock doesn't re-ask for the lock now.
218
- * Introduced NestedAdvisoryLockError when asking for different, nested advisory locksMySQL
219
-
220
- ### 0.0.4
221
-
222
- * Moved require into on_load, which should speed loading when AR doesn't have to spin up
223
-
224
- ### 0.0.3
225
-
226
- * Fought with ActiveRecord 3.0.x and 3.1.x. You don't want them if you use threads—they fail
227
- predictably.
228
-
229
- ### 0.0.2
230
-
231
- * Added warning log message for nested MySQL lock calls
232
- * Randomized lock wait time, which can help ameliorate lock contention
233
-
234
- ### 0.0.1
235
-
236
- * First whack
@@ -0,0 +1,19 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "activerecord", "~> 4.2.0"
6
+
7
+ platforms :ruby do
8
+ gem "mysql2", "< 0.5"
9
+ gem "pg", "~> 0.21"
10
+ gem "sqlite3", "~> 1.3.6"
11
+ end
12
+
13
+ platforms :jruby do
14
+ gem "activerecord-jdbcmysql-adapter"
15
+ gem "activerecord-jdbcpostgresql-adapter"
16
+ gem "activerecord-jdbcsqlite3-adapter"
17
+ end
18
+
19
+ gemspec path: "../"
@@ -2,12 +2,12 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "activerecord", "~> 4.0.0"
5
+ gem "activerecord", "~> 5.0.0"
6
6
 
7
7
  platforms :ruby do
8
8
  gem "mysql2"
9
9
  gem "pg"
10
- gem "sqlite3"
10
+ gem "sqlite3", "~> 1.3.6"
11
11
  end
12
12
 
13
13
  platforms :jruby do
@@ -16,4 +16,4 @@ platforms :jruby do
16
16
  gem "activerecord-jdbcsqlite3-adapter"
17
17
  end
18
18
 
19
- gemspec :path => "../"
19
+ gemspec path: "../"
@@ -2,12 +2,12 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "activerecord", "~> 4.1.0"
5
+ gem "activerecord", "~> 5.1.0"
6
6
 
7
7
  platforms :ruby do
8
8
  gem "mysql2"
9
9
  gem "pg"
10
- gem "sqlite3"
10
+ gem "sqlite3", "~> 1.3.6"
11
11
  end
12
12
 
13
13
  platforms :jruby do
@@ -16,4 +16,4 @@ platforms :jruby do
16
16
  gem "activerecord-jdbcsqlite3-adapter"
17
17
  end
18
18
 
19
- gemspec :path => "../"
19
+ gemspec path: "../"
@@ -2,13 +2,12 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "activerecord", :github => "rails/rails"
6
- gem "arel", :github => "rails/arel"
5
+ gem "activerecord", "~> 5.1.0"
7
6
 
8
7
  platforms :ruby do
9
8
  gem "mysql2"
10
9
  gem "pg"
11
- gem "sqlite3"
10
+ gem "sqlite3", "~> 1.3.6"
12
11
  end
13
12
 
14
13
  platforms :jruby do
@@ -17,4 +16,4 @@ platforms :jruby do
17
16
  gem "activerecord-jdbcsqlite3-adapter"
18
17
  end
19
18
 
20
- gemspec :path => "../"
19
+ gemspec path: "../"
@@ -2,7 +2,7 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "activerecord", "~> 3.2.0"
5
+ gem "activerecord", "~> 6.0.0"
6
6
 
7
7
  platforms :ruby do
8
8
  gem "mysql2"
@@ -16,4 +16,4 @@ platforms :jruby do
16
16
  gem "activerecord-jdbcsqlite3-adapter"
17
17
  end
18
18
 
19
- gemspec :path => "../"
19
+ gemspec path: "../"