with_advisory_lock 3.1.0 → 3.1.1
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.
- checksums.yaml +4 -4
- data/.travis.install-mysql-5.7.sh +11 -0
- data/.travis.yml +6 -0
- data/Appraisals +4 -0
- data/README.md +16 -14
- data/gemfiles/activerecord_5.1.gemfile +19 -0
- data/lib/with_advisory_lock.rb +1 -0
- data/lib/with_advisory_lock/version.rb +1 -1
- data/test/lock_test.rb +1 -1
- data/test/options_test.rb +4 -4
- data/test/shared_test.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 21f4b6ac2afa73ae66983bce969dc1786aab95a7
|
4
|
+
data.tar.gz: 8b4874809c6356b53d775764f0f7228658bfa9c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd2e76cc799d22fb4b1f67456eb282797337d9580b143d4cb38c26b0f24e45b7bfa8de19c2ab17f5a730bbcd7623654dd1703c43e5deaed9a05d6c3cf0ecebc8
|
7
|
+
data.tar.gz: 9bdbcafdb615da0af5671191f233b2c458ff1bfe1d63cf0bfff26da4d627070a985b9dc242da14c3a3a1ac511fedbbdb394b62a60172f3f4b430c66f5e24108f
|
@@ -0,0 +1,11 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
if [[ "${MYSQL_VERSION}" == "5.7" ]]; then
|
3
|
+
sudo service mysql stop || echo "mysql not stopped"
|
4
|
+
sudo stop mysql-5.6 || echo "mysql-5.6 not stopped"
|
5
|
+
echo mysql-apt-config mysql-apt-config/select-server select mysql-5.7 | sudo debconf-set-selections
|
6
|
+
wget http://dev.mysql.com/get/mysql-apt-config_0.7.3-1_all.deb
|
7
|
+
sudo dpkg --install mysql-apt-config_0.7.3-1_all.deb
|
8
|
+
sudo apt-get update -q
|
9
|
+
sudo apt-get install -q -y --allow-unauthenticated -o Dpkg::Options::=--force-confnew mysql-server
|
10
|
+
sudo mysql_upgrade
|
11
|
+
fi
|
data/.travis.yml
CHANGED
@@ -1,17 +1,22 @@
|
|
1
1
|
language: ruby
|
2
2
|
|
3
|
+
dist: trusty
|
4
|
+
sudo: required
|
5
|
+
|
3
6
|
rvm:
|
4
7
|
- 2.4.0
|
5
8
|
- 2.3.3
|
6
9
|
- 2.2.6
|
7
10
|
|
8
11
|
gemfile:
|
12
|
+
- gemfiles/activerecord_5.1.gemfile
|
9
13
|
- gemfiles/activerecord_5.0.gemfile
|
10
14
|
- gemfiles/activerecord_4.2.gemfile
|
11
15
|
|
12
16
|
env:
|
13
17
|
- DB=postgresql
|
14
18
|
- DB=mysql
|
19
|
+
- DB=mysql MYSQL_VERSION=5.7
|
15
20
|
- DB=sqlite
|
16
21
|
|
17
22
|
before_install:
|
@@ -20,6 +25,7 @@ before_install:
|
|
20
25
|
script: WITH_ADVISORY_LOCK_PREFIX=$TRAVIS_JOB_ID bundle exec rake --trace
|
21
26
|
|
22
27
|
before_script:
|
28
|
+
- bash .travis.install-mysql-5.7.sh
|
23
29
|
- mysql -e 'create database with_advisory_lock_test'
|
24
30
|
- psql -c 'create database with_advisory_lock_test' -U postgres
|
25
31
|
|
data/Appraisals
CHANGED
data/README.md
CHANGED
@@ -5,10 +5,8 @@ Adds advisory locking (mutexes) to ActiveRecord 4.2 and 5.0, with ruby 2.4, 2.3
|
|
5
5
|
or [PostgreSQL](http://www.postgresql.org/docs/9.3/static/functions-admin.html#FUNCTIONS-ADVISORY-LOCKS).
|
6
6
|
SQLite resorts to file locking.
|
7
7
|
|
8
|
-
[](https://codeclimate.com/github/mceachen/with_advisory_lock)
|
11
|
-
[](https://gemnasium.com/mceachen/with_advisory_lock)
|
8
|
+
[](http://travis-ci.org/ClosureTree/with_advisory_lock)
|
9
|
+
[](https://badge.fury.io/rb/with_advisory_lock)
|
12
10
|
|
13
11
|
## What's an "Advisory Lock"?
|
14
12
|
|
@@ -114,7 +112,7 @@ most commonly used lock.**
|
|
114
112
|
|
115
113
|
### Table-level locks
|
116
114
|
|
117
|
-
Provided through something like the [monogamy](https://github.com/
|
115
|
+
Provided through something like the [monogamy](https://github.com/ClosureTree/monogamy)
|
118
116
|
gem, these prevent concurrent access to **any instance of a model**. Their coarseness means they
|
119
117
|
aren't going to be commonly applicable, and they can be a source of
|
120
118
|
[deadlocks](http://en.wikipedia.org/wiki/Deadlock).
|
@@ -136,12 +134,12 @@ lock again, and the block given will be yielded to.
|
|
136
134
|
|
137
135
|
### Is clustered MySQL supported?
|
138
136
|
|
139
|
-
[No.](https://github.com/
|
137
|
+
[No.](https://github.com/ClosureTree/with_advisory_lock/issues/16)
|
140
138
|
|
141
139
|
### There are many ```lock-*``` files in my project directory after test runs
|
142
140
|
|
143
141
|
This is expected if you aren't using MySQL or Postgresql for your tests.
|
144
|
-
See [issue 3](https://github.com/
|
142
|
+
See [issue 3](https://github.com/ClosureTree/with_advisory_lock/issues/3).
|
145
143
|
|
146
144
|
SQLite doesn't have advisory locks, so we resort to file locking, which will only work
|
147
145
|
if the ```FLOCK_DIR``` is set consistently for all ruby processes.
|
@@ -160,9 +158,13 @@ end
|
|
160
158
|
|
161
159
|
## Changelog
|
162
160
|
|
161
|
+
### 3.1.1
|
162
|
+
|
163
|
+
* [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!
|
164
|
+
|
163
165
|
### 3.1.0
|
164
166
|
|
165
|
-
* [Jason Weathered](https://github.com/jasoncodes) Added new shared and transaction-level lock options ([Pull request 21](https://github.com/
|
167
|
+
* [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!
|
166
168
|
* 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/)
|
167
169
|
* Replaced ruby 1.9 and 2.0 (both EOL) with ruby 2.2 and 2.3 (see https://www.ruby-lang.org/en/downloads/)
|
168
170
|
|
@@ -185,7 +187,7 @@ end
|
|
185
187
|
* Lock timeouts of 0 now attempt the lock once, as per suggested by
|
186
188
|
[Jon Leighton](https://github.com/jonleighton) and implemented by
|
187
189
|
[Abdelkader Boudih](https://github.com/seuros). Thanks to both of you!
|
188
|
-
* [Pull request 11](https://github.com/
|
190
|
+
* [Pull request 11](https://github.com/ClosureTree/with_advisory_lock/pull/11)
|
189
191
|
fixed a downstream issue with jruby support! Thanks, [Aaron Todd](https://github.com/ozzyaaron)!
|
190
192
|
* Added Travis tests for jruby
|
191
193
|
* Dropped support for Rails 3.0, 3.1, and Ruby 1.8.7, as they are no longer
|
@@ -207,9 +209,9 @@ end
|
|
207
209
|
|
208
210
|
### 0.0.9
|
209
211
|
|
210
|
-
* Merged in Postgis Adapter Support to address [issue 7](https://github.com/
|
212
|
+
* Merged in Postgis Adapter Support to address [issue 7](https://github.com/ClosureTree/with_advisory_lock/issues/7)
|
211
213
|
Thanks for the pull request, [Abdelkader Boudih](https://github.com/seuros)!
|
212
|
-
* The database switching code had to be duplicated by [Closure Tree](https://github.com/
|
214
|
+
* The database switching code had to be duplicated by [Closure Tree](https://github.com/ClosureTree/closure_tree),
|
213
215
|
so I extracted a new ```WithAdvisoryLock::DatabaseAdapterSupport``` one-trick pony.
|
214
216
|
* Builds were failing on Travis, so I introduced a global lock prefix that can be set with the
|
215
217
|
```WITH_ADVISORY_LOCK_PREFIX``` environment variable. I'm not going to advertise this feature yet.
|
@@ -217,13 +219,13 @@ end
|
|
217
219
|
|
218
220
|
### 0.0.8
|
219
221
|
|
220
|
-
* Addressed [issue 5](https://github.com/
|
222
|
+
* Addressed [issue 5](https://github.com/ClosureTree/with_advisory_lock/issues/5) by
|
221
223
|
using a deterministic hash for Postgresql + MRI >= 1.9.
|
222
224
|
Thanks for the pull request, [Joel Turkel](https://github.com/jturkel)!
|
223
|
-
* Addressed [issue 2](https://github.com/
|
225
|
+
* Addressed [issue 2](https://github.com/ClosureTree/with_advisory_lock/issues/2) by
|
224
226
|
using a cache-busting query for MySQL and Postgres to deal with AR value caching bug.
|
225
227
|
Thanks for the pull request, [Jaime Giraldo](https://github.com/sposmen)!
|
226
|
-
* Addressed [issue 4](https://github.com/
|
228
|
+
* Addressed [issue 4](https://github.com/ClosureTree/with_advisory_lock/issues/4) by
|
227
229
|
adding support for ```em-postgresql-adapter```.
|
228
230
|
Thanks, [lestercsp](https://github.com/lestercsp)!
|
229
231
|
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gem "activerecord", "~> 5.1.0"
|
6
|
+
|
7
|
+
platforms :ruby do
|
8
|
+
gem "mysql2", "~> 0.3.10"
|
9
|
+
gem "pg", "< 0.19"
|
10
|
+
gem "sqlite3"
|
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: "../"
|
data/lib/with_advisory_lock.rb
CHANGED
data/test/lock_test.rb
CHANGED
@@ -11,7 +11,7 @@ describe 'class methods' do
|
|
11
11
|
it 'returns the name of the last lock acquired' do
|
12
12
|
Tag.with_advisory_lock(lock_name) do
|
13
13
|
# The lock name may have a prefix if WITH_ADVISORY_LOCK_PREFIX env is set
|
14
|
-
Tag.current_advisory_lock.must_match
|
14
|
+
Tag.current_advisory_lock.must_match(/#{lock_name}/)
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
data/test/options_test.rb
CHANGED
@@ -7,14 +7,14 @@ describe 'options parsing' do
|
|
7
7
|
|
8
8
|
specify 'defaults (empty hash)' do
|
9
9
|
impl = parse_options({})
|
10
|
-
impl.timeout_seconds.
|
10
|
+
impl.timeout_seconds.must_be_nil
|
11
11
|
impl.shared.must_equal false
|
12
12
|
impl.transaction.must_equal false
|
13
13
|
end
|
14
14
|
|
15
15
|
specify 'nil sets timeout to nil' do
|
16
16
|
impl = parse_options(nil)
|
17
|
-
impl.timeout_seconds.
|
17
|
+
impl.timeout_seconds.must_be_nil
|
18
18
|
impl.shared.must_equal false
|
19
19
|
impl.transaction.must_equal false
|
20
20
|
end
|
@@ -41,14 +41,14 @@ describe 'options parsing' do
|
|
41
41
|
|
42
42
|
specify 'hash with shared option sets shared to true' do
|
43
43
|
impl = parse_options(shared: true)
|
44
|
-
impl.timeout_seconds.
|
44
|
+
impl.timeout_seconds.must_be_nil
|
45
45
|
impl.shared.must_equal true
|
46
46
|
impl.transaction.must_equal false
|
47
47
|
end
|
48
48
|
|
49
49
|
specify 'hash with transaction option set transaction to true' do
|
50
50
|
impl = parse_options(transaction: true)
|
51
|
-
impl.timeout_seconds.
|
51
|
+
impl.timeout_seconds.must_be_nil
|
52
52
|
impl.shared.must_equal false
|
53
53
|
impl.transaction.must_equal true
|
54
54
|
end
|
data/test/shared_test.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: with_advisory_lock
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew McEachen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-08-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -130,6 +130,7 @@ extensions: []
|
|
130
130
|
extra_rdoc_files: []
|
131
131
|
files:
|
132
132
|
- ".gitignore"
|
133
|
+
- ".travis.install-mysql-5.7.sh"
|
133
134
|
- ".travis.yml"
|
134
135
|
- Appraisals
|
135
136
|
- Gemfile
|
@@ -138,6 +139,7 @@ files:
|
|
138
139
|
- Rakefile
|
139
140
|
- gemfiles/activerecord_4.2.gemfile
|
140
141
|
- gemfiles/activerecord_5.0.gemfile
|
142
|
+
- gemfiles/activerecord_5.1.gemfile
|
141
143
|
- lib/with_advisory_lock.rb
|
142
144
|
- lib/with_advisory_lock/base.rb
|
143
145
|
- lib/with_advisory_lock/concern.rb
|
@@ -180,7 +182,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
180
182
|
version: '0'
|
181
183
|
requirements: []
|
182
184
|
rubyforge_project:
|
183
|
-
rubygems_version: 2.
|
185
|
+
rubygems_version: 2.6.8
|
184
186
|
signing_key:
|
185
187
|
specification_version: 4
|
186
188
|
summary: Advisory locking for ActiveRecord
|