active_record_mutex 2.3.0 → 2.3.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
  SHA1:
3
- metadata.gz: 82a2b14490ab51a0627c72260226d1742b1c0441
4
- data.tar.gz: c487aa29472b77887e5dec81cd7f624676091d4a
3
+ metadata.gz: 6bf481e6f72cd3e22fc6edd76ad501b90f357561
4
+ data.tar.gz: 592bbf4128ad8914a4898c437accfb5dafbd015e
5
5
  SHA512:
6
- metadata.gz: 52337abd846212ae910f0d66ba99b39e35e02ad55a540e952dcbee8f195ec4c74d5dbc5f507d2f3dfa9e8b1189c6ba4e245805015893f561fdcd8c1eea4ca8fc
7
- data.tar.gz: cbaceacb0cb2e06fef1b1d4a89b5940400e2a06213d7ab031f22f5151087357d0f5e8e092b9acdff49de08a8b133a8647ee064f8b9dea0fafbb82b8b85f9e4f8
6
+ metadata.gz: acc8d2dd78a7632eabdb02647e304097d1eab268f62c61e80580c6f19f625919860adbfa6fd7f1e68243b78aa0cf736cf7cc83d3763911cd21c80b76077f8606
7
+ data.tar.gz: b11f4b34edcaba4e2a54971c6838d69f03abd0396d6ffcdeb9a6f9bb7f119065793aee0c8b5a572c5bfcbf124f550da55809f4d22e623038a4088d1218dd1a5d
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.3.0
1
+ 2.3.1
@@ -1,9 +1,9 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: active_record_mutex 2.3.0 ruby lib
2
+ # stub: active_record_mutex 2.3.1 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "active_record_mutex"
6
- s.version = "2.3.0"
6
+ s.version = "2.3.1"
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"]
@@ -1,3 +1,5 @@
1
+ require 'base64'
2
+
1
3
  module ActiveRecord
2
4
  module DatabaseMutex
3
5
  class Implementation
@@ -116,7 +118,9 @@ module ActiveRecord
116
118
  end
117
119
 
118
120
  def counter
119
- "@#{name}_mutex_counter"
121
+ encoded_name = Base64.encode64(name).delete('^A-Za-z0-9+/').
122
+ gsub(/[+\/]/, ?+ => ?_, ?/ => ?.)
123
+ "@#{encoded_name}_mutex_counter"
120
124
  end
121
125
 
122
126
  def increase_counter
@@ -1,6 +1,6 @@
1
1
  module ActiveRecord::DatabaseMutex
2
2
  # ActiveRecord::DatabaseMutex version
3
- VERSION = '2.3.0'
3
+ VERSION = '2.3.1'
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:
@@ -146,4 +146,11 @@ class DatabaseMutexTest < Test::Unit::TestCase
146
146
  end
147
147
  assert_nil mutex.synchronize {}
148
148
  end
149
+
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
155
+ end
149
156
  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.0
4
+ version: 2.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Frank