active_record_mutex 2.3.1 → 2.3.2
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aafe3c705988ad9cab9db8346d85935f1b94de2c
|
4
|
+
data.tar.gz: be7b71975f7740d6adaac306fa64fad71305a1d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bfc5ae34fd11e782db2e317c568c7fe490eb76d896f9e35e6b1dd3161572a7bcda616b566515f3ca451a42c7d3ddca04dea808a4c9835cc532a0bb4f45c547d9
|
7
|
+
data.tar.gz: cb27416ab27496bebe7e06f36214c7a010a9a8a27c3e4604c0a6687e883e673842d99b8cc65aacf2f66e070b8dc1d96a6bf8710e81c27b7d6fa6703a03a1d552
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.3.
|
1
|
+
2.3.2
|
data/active_record_mutex.gemspec
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: active_record_mutex 2.3.
|
2
|
+
# stub: active_record_mutex 2.3.2 ruby lib
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "active_record_mutex"
|
6
|
-
s.version = "2.3.
|
6
|
+
s.version = "2.3.2"
|
7
7
|
|
8
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
9
9
|
s.require_paths = ["lib"]
|
@@ -6,6 +6,7 @@ module ActiveRecord
|
|
6
6
|
# Creates a mutex with the name given with the option :name.
|
7
7
|
def initialize(opts = {})
|
8
8
|
@name = opts[:name] or raise ArgumentError, "mutex requires a :name argument"
|
9
|
+
counter or raise ArgumentError, 'argument :name is too long'
|
9
10
|
end
|
10
11
|
|
11
12
|
# Returns the name of this mutex as given as a constructor argument.
|
@@ -118,9 +119,11 @@ module ActiveRecord
|
|
118
119
|
end
|
119
120
|
|
120
121
|
def counter
|
121
|
-
encoded_name = Base64.encode64(name).delete('^A-Za-z0-9+/').
|
122
|
+
encoded_name = ?$ + Base64.encode64(name).delete('^A-Za-z0-9+/').
|
122
123
|
gsub(/[+\/]/, ?+ => ?_, ?/ => ?.)
|
123
|
-
|
124
|
+
if encoded_name.size <= 64 # mysql 5.7 only allows size <=64 variable names
|
125
|
+
"@#{encoded_name}"
|
126
|
+
end
|
124
127
|
end
|
125
128
|
|
126
129
|
def increase_counter
|
data/test/database_mutex_test.rb
CHANGED
@@ -148,9 +148,7 @@ class DatabaseMutexTest < Test::Unit::TestCase
|
|
148
148
|
end
|
149
149
|
|
150
150
|
def test_counter_name
|
151
|
-
mutex = Implementation.new(:name => (
|
152
|
-
assert_equal
|
153
|
-
@AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0_P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6e3x9fn_AgYKDhIWGh4iJiouMjY6PkJGSk5SVlpeYmZqbnJ2en6ChoqOkpaanqKmqq6ytrq_wsbKztLW2t7i5uru8vb6.wMHCw8TFxsfIycrLzM3Oz9DR0tPU1dbX2Nna29zd3t.g4eLj5OXm5_jp6uvs7e7v8PHy8.T19vf4_fr7.P3_.w_mutex_counter
|
154
|
-
EOS
|
151
|
+
mutex = Implementation.new(:name => (250..255).map(&:chr) * '')
|
152
|
+
assert_equal '@$_vv8.f7.', mutex.send(:counter)
|
155
153
|
end
|
156
154
|
end
|