db_lock 0.8.1 → 0.8.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
  SHA256:
3
- metadata.gz: a421d9ec42cc7b443b198621952641959bb9726af41c3e76a7d5ce5e5e974fc0
4
- data.tar.gz: d4b509db240d13dc43d1125b3ce57a868f8e2b812aca3b42d8939ddbf2c71503
3
+ metadata.gz: f59c12f3f279febb7c5350a2b4b6638d222bc50beeb038563a59afac4efa4328
4
+ data.tar.gz: 499be9d47073117184c99fdebf1f398eb2b50cb0aa5cd7e082fa55945033e263
5
5
  SHA512:
6
- metadata.gz: 627cb66c61e7af78f1a8ace1e1eff8722561e7d8a9704ad0443ca9a7aeb774ec2cf83747598dcbca429fe9bd3e83841b6a2ff1eeb0a95834d319e35108e46fd4
7
- data.tar.gz: 23cc2e806437a6b745391e1eedb4fb930bc8d32a5557426b5e4bb950934dd6b3229d2e2ed38f74bff4f453f457ae91ec2d73020e14867cbf04a8059eb86472ad
6
+ metadata.gz: c447141d577b1baa3fef43abd12ee20941603a0659b281514d58b6f797bfec611743c71f7a08b07d1a054417647313dca4847774b3314e2db21ca2f8779e084f
7
+ data.tar.gz: 941c56299b884aa698b6e9d1bbfa18ea83555dc77f2965a73b21cf6cf0f66a718ec68eb2c681a6ed6a13c0d428e896bce8e40ddef5ca49cc5a010cfafa43afd9
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # DBLock
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/db_lock.svg)](https://badge.fury.io/rb/db_lock)
4
- [![Build Status](https://travis-ci.org/mkon/db_lock.svg?branch=master)](https://travis-ci.org/mkon/db_lock)
4
+ [![Tests](https://github.com/mkon/db_lock/actions/workflows/test.yml/badge.svg)](https://github.com/mkon/db_lock/actions/workflows/test.yml)
5
5
 
6
6
  Gem to obtain and release manual db locks. This can be utilized for example to make sure that certain rake tasks do not run in parallel on the same database (for example when cron jobs run for too long or are accidentally started multiple times). Currently only supports:
7
7
 
data/lib/db_lock/lock.rb CHANGED
@@ -3,9 +3,12 @@ require 'digest/md5'
3
3
  module DBLock
4
4
  module Lock
5
5
  extend self
6
+
7
+ # rubocop:disable Metrics/AbcSize
6
8
  def get(name, timeout = 0)
7
9
  timeout = timeout.to_f # catches nil
8
10
  timeout = 0 if timeout.negative?
11
+
9
12
  raise "Invalid lock name: #{name.inspect}" if name.empty?
10
13
  raise AlreadyLocked, 'Already lock in progress' if locked?
11
14
 
@@ -21,6 +24,7 @@ module DBLock
21
24
  Adapter.release(name) if locked?
22
25
  @locked = false
23
26
  end
27
+ # rubocop:enable Metrics/AbcSize
24
28
 
25
29
  def locked?
26
30
  @locked ||= false
@@ -32,9 +36,7 @@ module DBLock
32
36
  name = "#{rails_app_name}.#{Rails.env}#{name}" if name[0] == '.' && defined? Rails
33
37
  # reduce lock names of > 64 chars in size
34
38
  # MySQL 5.7 only supports 64 chars max, there might be similar limitations elsewhere
35
- if name.length > 64
36
- name = "#{name.chars.first(15).join}-#{Digest::MD5.hexdigest(name)}-#{name.chars.last(15).join}"
37
- end
39
+ name = "#{name.chars.first(15).join}-#{Digest::MD5.hexdigest(name)}-#{name.chars.last(15).join}" if name.length > 64
38
40
  name
39
41
  end
40
42
 
@@ -1,3 +1,3 @@
1
1
  module DBLock
2
- VERSION = '0.8.1'.freeze
2
+ VERSION = '0.8.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: db_lock
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - mkon
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-09 00:00:00.000000000 Z
11
+ date: 2022-05-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -16,20 +16,20 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '4.2'
19
+ version: '5.2'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '7'
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: '5.2'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '7'
32
+ version: '7.1'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: rspec
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -50,28 +50,28 @@ dependencies:
50
50
  requirements:
51
51
  - - '='
52
52
  - !ruby/object:Gem::Version
53
- version: 0.81.0
53
+ version: 1.28.2
54
54
  type: :development
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  requirements:
58
58
  - - '='
59
59
  - !ruby/object:Gem::Version
60
- version: 0.81.0
60
+ version: 1.28.2
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: rubocop-rspec
63
63
  requirement: !ruby/object:Gem::Requirement
64
64
  requirements:
65
65
  - - '='
66
66
  - !ruby/object:Gem::Version
67
- version: 1.37.1
67
+ version: 2.10.0
68
68
  type: :development
69
69
  prerelease: false
70
70
  version_requirements: !ruby/object:Gem::Requirement
71
71
  requirements:
72
72
  - - '='
73
73
  - !ruby/object:Gem::Version
74
- version: 1.37.1
74
+ version: 2.10.0
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: simplecov
77
77
  requirement: !ruby/object:Gem::Requirement
@@ -106,8 +106,9 @@ files:
106
106
  homepage: https://github.com/mkon/db_lock
107
107
  licenses:
108
108
  - MIT
109
- metadata: {}
110
- post_install_message:
109
+ metadata:
110
+ rubygems_mfa_required: 'true'
111
+ post_install_message:
111
112
  rdoc_options: []
112
113
  require_paths:
113
114
  - lib
@@ -115,15 +116,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
115
116
  requirements:
116
117
  - - ">="
117
118
  - !ruby/object:Gem::Version
118
- version: '0'
119
+ version: '2.7'
120
+ - - "<"
121
+ - !ruby/object:Gem::Version
122
+ version: '3.1'
119
123
  required_rubygems_version: !ruby/object:Gem::Requirement
120
124
  requirements:
121
125
  - - ">="
122
126
  - !ruby/object:Gem::Version
123
127
  version: '0'
124
128
  requirements: []
125
- rubygems_version: 3.1.2
126
- signing_key:
129
+ rubygems_version: 3.2.15
130
+ signing_key:
127
131
  specification_version: 4
128
132
  summary: Obtain manual db/mysql locks
129
133
  test_files: []