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 +4 -4
- data/README.md +1 -1
- data/lib/mutex_migrations/migrator.rb +8 -12
- data/lib/mutex_migrations/semaphore.rb +1 -3
- data/lib/mutex_migrations/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '021650863c19b1d3a03636b737e16ae69f1ef12b6e60104c2088a705b6da8dd6'
|
4
|
+
data.tar.gz: 6578f3fd076038c3ecefc931986fc980f57fc54d2366d953c19a8d30677f524f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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
|
32
|
+
raise ConcurrentMigrationError unless Semaphore.instance.lock
|
33
33
|
|
34
|
-
|
34
|
+
load_migrated
|
35
35
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
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
|
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.
|
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:
|
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.
|
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: []
|