active_record_mutex 2.3.1 → 2.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6bf481e6f72cd3e22fc6edd76ad501b90f357561
4
- data.tar.gz: 592bbf4128ad8914a4898c437accfb5dafbd015e
3
+ metadata.gz: aafe3c705988ad9cab9db8346d85935f1b94de2c
4
+ data.tar.gz: be7b71975f7740d6adaac306fa64fad71305a1d6
5
5
  SHA512:
6
- metadata.gz: acc8d2dd78a7632eabdb02647e304097d1eab268f62c61e80580c6f19f625919860adbfa6fd7f1e68243b78aa0cf736cf7cc83d3763911cd21c80b76077f8606
7
- data.tar.gz: b11f4b34edcaba4e2a54971c6838d69f03abd0396d6ffcdeb9a6f9bb7f119065793aee0c8b5a572c5bfcbf124f550da55809f4d22e623038a4088d1218dd1a5d
6
+ metadata.gz: bfc5ae34fd11e782db2e317c568c7fe490eb76d896f9e35e6b1dd3161572a7bcda616b566515f3ca451a42c7d3ddca04dea808a4c9835cc532a0bb4f45c547d9
7
+ data.tar.gz: cb27416ab27496bebe7e06f36214c7a010a9a8a27c3e4604c0a6687e883e673842d99b8cc65aacf2f66e070b8dc1d96a6bf8710e81c27b7d6fa6703a03a1d552
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.3.1
1
+ 2.3.2
@@ -1,9 +1,9 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: active_record_mutex 2.3.1 ruby lib
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.1"
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
- "@#{encoded_name}_mutex_counter"
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
@@ -1,6 +1,6 @@
1
1
  module ActiveRecord::DatabaseMutex
2
2
  # ActiveRecord::DatabaseMutex version
3
- VERSION = '2.3.1'
3
+ VERSION = '2.3.2'
4
4
  VERSION_ARRAY = VERSION.split('.').map(&:to_i) # :nodoc:
5
5
  VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
6
6
  VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
@@ -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 => (0..255).map(&:chr) * '')
152
- assert_equal <<~EOS.chomp, mutex.send(:counter)
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_record_mutex
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.1
4
+ version: 2.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Frank