mutex_migrations 0.1.0 → 0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 46f975f701ccf4cd621b2185229bcfe76cd5f95e33af90abccd49e4d8c9be81e
4
- data.tar.gz: f1b688c7d78c791fecd1225bf1414ec43d06831ffee9de3688be68d201428831
3
+ metadata.gz: '021650863c19b1d3a03636b737e16ae69f1ef12b6e60104c2088a705b6da8dd6'
4
+ data.tar.gz: 6578f3fd076038c3ecefc931986fc980f57fc54d2366d953c19a8d30677f524f
5
5
  SHA512:
6
- metadata.gz: de6c4d5450d3c003d8c82577890338152998bd4849ecefc31d6a5179773a49fcf91d2388f47664d5d8ddee933f11c96fe86c1884f2a6d86d19b42cfebb0d33df
7
- data.tar.gz: 06c67b684c89afd8aa0c392f42d654b770ca81b1f16977f4e360b6af22a1459ee6f8e8abb4e74b0e09a5fe0afd8c732d72a7206720925f5ef4d1ef49bd821dd0
6
+ metadata.gz: 543043ac9ea76a707371f8e726b9d58f5859fa1a16c5dff879f30baf69e8c037c0bcae19f299d4af3f490addefd0b4e5186e4fbe0d574787f601381970fb34eb
7
+ data.tar.gz: 074ca37037dc272d5aa18f2fde93cf564e35f4ed418fab6d971f43198ebc772a378dd0b6a4437f5595fabe2f2ed68d955ea218f0236a8440f0f5cd202a2819d3
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  Hello!
4
4
  This gem was created when i faced ConcurrentMigrationError while using PgBouncer in transaction mode with rails 6.
5
5
  Bouncer in this mode is incompatbile with advisory locks, so to keep the functionality and fix the issue i've written this gem.
6
- It is using file locks instead of advisory locks.
6
+ It is using mutex instead of advisory locks.
7
7
 
8
8
 
9
9
  ## Installation
@@ -29,20 +29,16 @@ module MutexMigrations
29
29
  end
30
30
 
31
31
  def with_mutex_lock
32
- raise ConcurrentMigrationError if Semaphore.instance.locked?
32
+ raise ConcurrentMigrationError unless Semaphore.instance.lock
33
33
 
34
- Semaphore.instance.lock
34
+ load_migrated
35
35
 
36
- with_advisory_lock_connection do |connection|
37
- load_migrated
38
-
39
- yield
40
- ensure
41
- unless Semaphore.instance.unlock
42
- raise ConcurrentMigrationError.new(
43
- ConcurrentMigrationError::RELEASE_LOCK_FAILED_MESSAGE
44
- )
45
- end
36
+ yield
37
+ ensure
38
+ unless Semaphore.instance.unlock
39
+ raise ConcurrentMigrationError.new(
40
+ ConcurrentMigrationError::RELEASE_LOCK_FAILED_MESSAGE
41
+ )
46
42
  end
47
43
  end
48
44
  end
@@ -17,9 +17,7 @@ module MutexMigrations
17
17
  end
18
18
 
19
19
  def lock
20
- @mutex.lock
21
- rescue ThreadError
22
- false
20
+ @mutex.try_lock
23
21
  end
24
22
 
25
23
  def locked?
@@ -1,3 +1,3 @@
1
1
  module MutexMigrations
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mutex_migrations
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anton Shishkin
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-11-30 00:00:00.000000000 Z
11
+ date: 2022-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -97,7 +97,7 @@ metadata:
97
97
  homepage_uri: https://github.com/Thormill/mutex_migrations
98
98
  source_code_uri: https://github.com/Thormill/mutex_migrations
99
99
  changelog_uri: https://github.com/Thormill/mutex_migrations/changelog
100
- post_install_message:
100
+ post_install_message:
101
101
  rdoc_options: []
102
102
  require_paths:
103
103
  - lib
@@ -112,8 +112,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
112
112
  - !ruby/object:Gem::Version
113
113
  version: '0'
114
114
  requirements: []
115
- rubygems_version: 3.0.3
116
- signing_key:
115
+ rubygems_version: 3.3.3
116
+ signing_key:
117
117
  specification_version: 4
118
118
  summary: Using file locks in rails migrations instead of advisory locks
119
119
  test_files: []