with_transactional_lock 1.0.0 → 2.0.0

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
- SHA1:
3
- metadata.gz: 39e6b2f7021e9656666cecc940c89da9b7e8152b
4
- data.tar.gz: aa13d311218556caa23e1ea7f8212f6cfc920d55
2
+ SHA256:
3
+ metadata.gz: ff21d423161756a964b2f3d66e3d5100a053b2e5022a0ca22dcc834d320a6550
4
+ data.tar.gz: 15b38d52c10adb844e40e0538fcffe07f56efe0401da3fa9504e7bf3f982b8a4
5
5
  SHA512:
6
- metadata.gz: 478fd8a135e213bc74a9b1bd3d446a8091761685b19b1936bc129bafe9491dd9d8bc6d0b99ad412bedc314b3aaebfdba042c5a7aaa7c27e3b2d2201dde556aca
7
- data.tar.gz: adc45942dd45574a4b6a1a1f9b14df677b3c9f350dccdd2bf82d3a4ee388e526572c6c8f19bbc50e0f0c1027ecece4407eaf008f8bebc5cbcefec6a17739869a
6
+ metadata.gz: 2714430abc86449ff69d15a99b653e519571f811902dce63e4d9a73f89d917f90cd6ef1916fe92a308c92192453b72734b7c80e6b6d82db7f86c5ec93f87bf4c
7
+ data.tar.gz: 454d7a27ca333bf4a9e735afd3d21a5d7b7e1e4b1ff40ba9a72e93cd1504d69d47f076708e5943c6ea3a2a496024dd803688ba7f2c0aa2b207febf819724ef06
data/Rakefile CHANGED
@@ -14,7 +14,7 @@ RDoc::Task.new(:rdoc) do |rdoc|
14
14
  rdoc.rdoc_files.include('lib/**/*.rb')
15
15
  end
16
16
 
17
- APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
17
+ APP_RAKEFILE = File.expand_path('spec/dummy/Rakefile', __dir__)
18
18
  load 'rails/tasks/engine.rake'
19
19
  load 'rails/tasks/statistics.rake'
20
20
 
@@ -5,7 +5,7 @@ module WithTransactionalLock
5
5
  module Generators
6
6
  class InstallGenerator < Rails::Generators::Base
7
7
  include Rails::Generators::Migration
8
- source_root File.expand_path('../templates', __FILE__)
8
+ source_root File.expand_path('templates', __dir__)
9
9
 
10
10
  def show_readme
11
11
  readme 'README'
@@ -15,7 +15,7 @@ module WithTransactionalLock
15
15
  if mysql?
16
16
  migration_template(
17
17
  'db/migrate/create_transactional_advisory_locks.rb',
18
- 'db/migrate/create_transactional_advisory_locks.rb'
18
+ 'db/migrate/create_transactional_advisory_locks.rb',
19
19
  )
20
20
  end
21
21
  end
@@ -13,7 +13,7 @@ module WithTransactionalLock
13
13
  private
14
14
 
15
15
  def _advisory_lock_class
16
- @_advisory_lock_class ||= AdvisoryLockClassLocator.locate(connection)
16
+ @_advisory_lock_class ||= AdvisoryLockClassLocator.locate(connection) # rubocop:disable Naming/MemoizedInstanceVariableName
17
17
  end
18
18
  end
19
19
 
@@ -49,7 +49,7 @@ module WithTransactionalLock
49
49
  private
50
50
 
51
51
  def db_lock_name
52
- @db_lock_name ||= Digest::SHA256.digest(lock_name)[0, 8].unpack('q').first
52
+ @db_lock_name ||= Digest::SHA256.digest(lock_name)[0, 8].unpack1('q')
53
53
  end
54
54
  end
55
55
 
@@ -4,9 +4,7 @@ module WithTransactionalLock
4
4
  klass.connection_pool.with_connection do |conn|
5
5
  target_count = conn.select_value('select count(1) from transactional_advisory_locks')
6
6
  count = 0
7
- until count >= target_count
8
- count += conn.delete('delete from transactional_advisory_locks limit 1000')
9
- end
7
+ count += conn.delete('delete from transactional_advisory_locks limit 1000') until count >= target_count
10
8
  end
11
9
  end
12
10
  end
@@ -1,3 +1,3 @@
1
1
  module WithTransactionalLock
2
- VERSION = "1.0.0"
2
+ VERSION = "2.0.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: with_transactional_lock
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Moore
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-03 00:00:00.000000000 Z
11
+ date: 2019-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,20 +16,20 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '4.2'
19
+ version: '5.1'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '6'
22
+ version: '7'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: '4.2'
29
+ version: '5.1'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '6'
32
+ version: '7'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: appraisal
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -72,6 +72,34 @@ dependencies:
72
72
  - - "<"
73
73
  - !ruby/object:Gem::Version
74
74
  version: '3'
75
+ - !ruby/object:Gem::Dependency
76
+ name: mysql2
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - '='
80
+ - !ruby/object:Gem::Version
81
+ version: 0.4.5
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - '='
87
+ - !ruby/object:Gem::Version
88
+ version: 0.4.5
89
+ - !ruby/object:Gem::Dependency
90
+ name: pg
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - "~>"
94
+ - !ruby/object:Gem::Version
95
+ version: '0.1'
96
+ type: :development
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - "~>"
101
+ - !ruby/object:Gem::Version
102
+ version: '0.1'
75
103
  - !ruby/object:Gem::Dependency
76
104
  name: rspec-rails
77
105
  requirement: !ruby/object:Gem::Requirement
@@ -166,8 +194,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
166
194
  - !ruby/object:Gem::Version
167
195
  version: '0'
168
196
  requirements: []
169
- rubyforge_project:
170
- rubygems_version: 2.5.1
197
+ rubygems_version: 3.0.3
171
198
  signing_key:
172
199
  specification_version: 4
173
200
  summary: Transactional advisory locks for ActiveRecord