with_transactional_lock 1.0.0 → 2.0.1

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: e1ce902a567cad70abdbda27991f1237e06c41a2bf7c28c85d48560ecb01ccb5
4
+ data.tar.gz: '018ee632496ea69c1cb860a22143415105321a0150cd87cf975e585f2c3b2e99'
5
5
  SHA512:
6
- metadata.gz: 478fd8a135e213bc74a9b1bd3d446a8091761685b19b1936bc129bafe9491dd9d8bc6d0b99ad412bedc314b3aaebfdba042c5a7aaa7c27e3b2d2201dde556aca
7
- data.tar.gz: adc45942dd45574a4b6a1a1f9b14df677b3c9f350dccdd2bf82d3a4ee388e526572c6c8f19bbc50e0f0c1027ecece4407eaf008f8bebc5cbcefec6a17739869a
6
+ metadata.gz: 5817b5fde890a9f9ca5bf8857bbc01fa6f540ed12394b472cd1a743f9441faee31cb829d570f9ab0f6b352f3f751c3c4a774b941eb492939a3caf41ad5ee793d
7
+ data.tar.gz: 4a3a791d02758d6fe27ad4d7bc64282e50b5a0dd3e3711197bb89d2e5566adb3ee6f3013b5809a7489aa6c72c27d1045e12a2ee23d35ba433e45985519004622
data/README.md CHANGED
@@ -102,6 +102,12 @@ with the name that you provided. Your block is free to execute its
102
102
  critical work. Upon completion of your transaction, the lock will be
103
103
  released.
104
104
 
105
+ ### Publishing the gem
106
+
107
+ If you make changes to this gem, you will need to publish the changes to a new version on Github Packages, where the private Betterment RubyGems registry is.
108
+
109
+ For instructions on how to publish this gem, read this article on ["Publishing Internal Gems" from the Betterment Engineering Wiki](https://betterconfluence.atlassian.net/wiki/spaces/BetterEng/pages/2840952833/Publishing+Internal+Gems).
110
+
105
111
  ## Supported databases
106
112
 
107
113
  ### PostgreSQL
data/Rakefile CHANGED
@@ -14,28 +14,28 @@ 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
 
21
21
  Bundler::GemHelper.install_tasks
22
22
 
23
- if Rails.env.development? || Rails.env.test?
24
- if defined? Dummy
25
- require 'rspec/core'
26
- require 'rspec/core/rake_task'
27
- require 'rubocop/rake_task'
28
-
29
- RuboCop::RakeTask.new
30
- RSpec::Core::RakeTask.new(:spec)
31
-
32
- task(:default).clear
33
- if ENV['APPRAISAL_INITIALIZED'] || ENV['TRAVIS']
34
- task default: %i(rubocop spec)
35
- else
36
- require 'appraisal'
37
- Appraisal::Task.new
38
- task default: :appraisal
39
- end
23
+ if (Rails.env.development? || Rails.env.test?) && defined? Dummy
24
+ require 'rspec/core'
25
+ require 'rspec/core/rake_task'
26
+ require 'rubocop/rake_task'
27
+
28
+ RuboCop::RakeTask.new
29
+ RSpec::Core::RakeTask.new(:spec)
30
+
31
+ task(:default).clear
32
+ if ENV['APPRAISAL_INITIALIZED'] || ENV['CI']
33
+ tasks += [:rubocop] unless ENV['CI']
34
+
35
+ task default: tasks
36
+ else
37
+ require 'appraisal'
38
+ Appraisal::Task.new
39
+ task default: :appraisal
40
40
  end
41
41
  end
@@ -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
@@ -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.1"
3
3
  end
@@ -7,5 +7,5 @@ module WithTransactionalLock
7
7
  end
8
8
 
9
9
  ActiveSupport.on_load :active_record do
10
- ActiveRecord::Base.send :include, WithTransactionalLock::Mixin
10
+ ActiveRecord::Base.include WithTransactionalLock::Mixin
11
11
  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.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Moore
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-03 00:00:00.000000000 Z
11
+ date: 2023-06-12 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: '6.0'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '6'
22
+ version: '7.1'
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: '6.0'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '6'
32
+ version: '7.1'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: appraisal
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -44,6 +44,20 @@ dependencies:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
46
  version: 2.2.0
47
+ - !ruby/object:Gem::Dependency
48
+ name: betterlint
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
47
61
  - !ruby/object:Gem::Dependency
48
62
  name: database_cleaner
49
63
  requirement: !ruby/object:Gem::Requirement
@@ -62,16 +76,44 @@ dependencies:
62
76
  name: mime-types
63
77
  requirement: !ruby/object:Gem::Requirement
64
78
  requirements:
65
- - - "<"
79
+ - - ">="
66
80
  - !ruby/object:Gem::Version
67
- version: '3'
81
+ version: '0'
68
82
  type: :development
69
83
  prerelease: false
70
84
  version_requirements: !ruby/object:Gem::Requirement
71
85
  requirements:
72
- - - "<"
86
+ - - ">="
73
87
  - !ruby/object:Gem::Version
74
- version: '3'
88
+ version: '0'
89
+ - !ruby/object:Gem::Dependency
90
+ name: mysql2
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ type: :development
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ - !ruby/object:Gem::Dependency
104
+ name: pg
105
+ requirement: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - ">="
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ type: :development
111
+ prerelease: false
112
+ version_requirements: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - ">="
115
+ - !ruby/object:Gem::Version
116
+ version: '0'
75
117
  - !ruby/object:Gem::Dependency
76
118
  name: rspec-rails
77
119
  requirement: !ruby/object:Gem::Requirement
@@ -101,19 +143,19 @@ dependencies:
101
143
  - !ruby/object:Gem::Version
102
144
  version: '0'
103
145
  - !ruby/object:Gem::Dependency
104
- name: rubocop-betterment
146
+ name: sprockets
105
147
  requirement: !ruby/object:Gem::Requirement
106
148
  requirements:
107
- - - ">="
149
+ - - "~>"
108
150
  - !ruby/object:Gem::Version
109
- version: '0'
151
+ version: '3.0'
110
152
  type: :development
111
153
  prerelease: false
112
154
  version_requirements: !ruby/object:Gem::Requirement
113
155
  requirements:
114
- - - ">="
156
+ - - "~>"
115
157
  - !ruby/object:Gem::Version
116
- version: '0'
158
+ version: '3.0'
117
159
  - !ruby/object:Gem::Dependency
118
160
  name: travis
119
161
  requirement: !ruby/object:Gem::Requirement
@@ -151,7 +193,7 @@ homepage: https://github.com/Betterment/with_transactional_lock
151
193
  licenses:
152
194
  - MIT
153
195
  metadata: {}
154
- post_install_message:
196
+ post_install_message:
155
197
  rdoc_options: []
156
198
  require_paths:
157
199
  - lib
@@ -166,9 +208,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
166
208
  - !ruby/object:Gem::Version
167
209
  version: '0'
168
210
  requirements: []
169
- rubyforge_project:
170
- rubygems_version: 2.5.1
171
- signing_key:
211
+ rubygems_version: 3.4.13
212
+ signing_key:
172
213
  specification_version: 4
173
214
  summary: Transactional advisory locks for ActiveRecord
174
215
  test_files: []