rails_migrate_mutex 1.1.1 → 1.2.0
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/lib/rails_migrate_mutex.rb +1 -0
- data/lib/tasks/migrate_mutex.rake +9 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e90b0249a724e31ff7b4614e03b2ed362367932a
|
4
|
+
data.tar.gz: b461921ac5f8b634cc370a48800affb94470f2f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8aa2122ad763a9ae64854bab0ff979258fbb5ce2cc0fa895c3e477f8d9805cbaf18fde0618c954b4f59648ece714847740d24269d89b1a6d09f096c91743d04d
|
7
|
+
data.tar.gz: 7b4dfff0112e501d11de53d5362407c8de3d4b1ae38ea2b6887d567c01f299bbb0ee417c12b9814ae86b72433824d76379e2a804f4db61914d77e671496ffaa8
|
data/lib/rails_migrate_mutex.rb
CHANGED
@@ -1,10 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
namespace :db do
|
2
3
|
namespace :migrate do
|
3
4
|
desc 'Runs db:migrate in a redis-backed mutex'
|
4
|
-
task :
|
5
|
+
task mutex: [:environment] do
|
5
6
|
TIMEOUT = 5 * 60 * 60
|
6
7
|
|
7
|
-
|
8
|
+
# We want to set the redis instance to a sensible default, but only if it has not been set.
|
9
|
+
# If it has not been set, it will raise an error. It's a bit messy, but works fine.
|
10
|
+
begin
|
11
|
+
RedisClassy.redis
|
12
|
+
rescue RedisClassy::Error
|
13
|
+
RedisClassy.redis = Redis.current
|
14
|
+
end
|
8
15
|
|
9
16
|
RedisMutex.with_lock('db-migrate-mutex', block: TIMEOUT, expire: TIMEOUT) do
|
10
17
|
Rake::Task['db:migrate'].invoke
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_migrate_mutex
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ad2games GmbH
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-11-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -80,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
80
80
|
version: '0'
|
81
81
|
requirements: []
|
82
82
|
rubyforge_project:
|
83
|
-
rubygems_version: 2.
|
83
|
+
rubygems_version: 2.6.8
|
84
84
|
signing_key:
|
85
85
|
specification_version: 4
|
86
86
|
summary: Runs Rails migrations in a Redis-backed mutex.
|