simple_mutex 1.0.0 → 1.0.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 +4 -4
- data/.github/{worklows/ci.yml → workflows/main.yml} +2 -1
- data/CHANGELOG.md +14 -0
- data/Gemfile.lock +12 -2
- data/README.md +3 -1
- data/lib/simple_mutex/base_cleaner.rb +10 -17
- data/lib/simple_mutex/mutex.rb +1 -1
- data/lib/simple_mutex/sidekiq_support/batch_cleaner.rb +1 -1
- data/lib/simple_mutex/sidekiq_support/job_cleaner.rb +1 -1
- data/lib/simple_mutex/version.rb +1 -1
- data/simple_mutex.gemspec +2 -0
- metadata +33 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 003ab1f3d7a72c1ed87d20272d4e7e84c8b486fd7dc3a34539ee8ce21688199d
|
4
|
+
data.tar.gz: e392b0b025b830ea18f062e402c1608562ad3992d3c8c100a266e77f7392dbb5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4385df59ccb07e0781ff83575d2137907ebc022e2971d2cb9e5f000c70075f7685585e5f93ac3b8dcf5d8798dbb28400441f1bf263c6d34167a22740f1661edd
|
7
|
+
data.tar.gz: 1c0bd82fce378dfe91f8d778792a325f14191547ce3e6d464cb1b472299480378299283a28340c4299ff5a1d4dd63ab49204e825d31ba85adcc7e7f0f8719784
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
All notable changes to this project will be documented in this file.
|
4
|
+
|
5
|
+
## [1.0.1]
|
6
|
+
|
7
|
+
- Bugfix with active job/batches memoization in `SimpleMutex::SidekiqSupport::JobCleaner` and
|
8
|
+
`SimpleMutex:SidekiqSupport::BatchCleaner`
|
9
|
+
- Simplecov added
|
10
|
+
- More tests added for 100% coverage
|
11
|
+
|
12
|
+
## [1.0.0]
|
13
|
+
|
14
|
+
Initial public release
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
simple_mutex (1.0.
|
4
|
+
simple_mutex (1.0.1)
|
5
5
|
redis
|
6
6
|
redis-namespace
|
7
7
|
sidekiq
|
@@ -22,6 +22,7 @@ GEM
|
|
22
22
|
concurrent-ruby (1.1.9)
|
23
23
|
connection_pool (2.2.5)
|
24
24
|
diff-lcs (1.4.4)
|
25
|
+
docile (1.4.0)
|
25
26
|
i18n (1.8.10)
|
26
27
|
concurrent-ruby (~> 1.0)
|
27
28
|
minitest (5.14.4)
|
@@ -84,10 +85,17 @@ GEM
|
|
84
85
|
rubocop (~> 1.0)
|
85
86
|
ruby-progressbar (1.11.0)
|
86
87
|
ruby2_keywords (0.0.5)
|
87
|
-
sidekiq (6.
|
88
|
+
sidekiq (6.3.1)
|
88
89
|
connection_pool (>= 2.2.2)
|
89
90
|
rack (~> 2.0)
|
90
91
|
redis (>= 4.2.0)
|
92
|
+
simplecov (0.21.2)
|
93
|
+
docile (~> 1.1)
|
94
|
+
simplecov-html (~> 0.11)
|
95
|
+
simplecov_json_formatter (~> 0.1)
|
96
|
+
simplecov-html (0.12.3)
|
97
|
+
simplecov-lcov (0.8.0)
|
98
|
+
simplecov_json_formatter (0.1.3)
|
91
99
|
thor (1.1.0)
|
92
100
|
timecop (0.9.4)
|
93
101
|
tzinfo (2.0.4)
|
@@ -107,6 +115,8 @@ DEPENDENCIES
|
|
107
115
|
rubocop-config-umbrellio
|
108
116
|
rubocop-rspec
|
109
117
|
simple_mutex!
|
118
|
+
simplecov
|
119
|
+
simplecov-lcov
|
110
120
|
timecop
|
111
121
|
|
112
122
|
BUNDLED WITH
|
data/README.md
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
|
2
|
+
# SimpleMutex · [](https://badge.fury.io/rb/simple_mutex) [](https://coveralls.io/github/umbrellio/simple_mutex?branch=main)
|
3
|
+
|
2
4
|
|
3
5
|
`SimpleMutex::Mutex` - Redis-based locks with ability to store custom data inside them.
|
4
6
|
|
@@ -21,11 +21,11 @@ module SimpleMutex
|
|
21
21
|
|
22
22
|
next redis.unwatch if entity_id.nil? || active?(entity_id)
|
23
23
|
|
24
|
-
return_value = redis.multi {
|
24
|
+
return_value = redis.multi { |multi| multi.del(lock_key) }
|
25
25
|
|
26
26
|
log_iteration(lock_key, raw_data, return_value) unless logger.nil?
|
27
27
|
|
28
|
-
return_value
|
28
|
+
return_value&.first&.positive?
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
@@ -38,17 +38,9 @@ module SimpleMutex
|
|
38
38
|
active_entity_ids.include?(entity_id)
|
39
39
|
end
|
40
40
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
def path_to_entity_id
|
46
|
-
raise NoMethodError
|
47
|
-
end
|
48
|
-
|
49
|
-
def get_active_entity_ids
|
50
|
-
raise NoMethodError
|
51
|
-
end
|
41
|
+
# @!method type
|
42
|
+
# @!method path_to_entity_id
|
43
|
+
# @!method get_active_entity_ids
|
52
44
|
|
53
45
|
def safe_parse(raw_data)
|
54
46
|
JSON.parse(raw_data)
|
@@ -65,11 +57,12 @@ module SimpleMutex
|
|
65
57
|
def log_iteration(lock_key, raw_data, return_value)
|
66
58
|
log_msg = generate_log_msg(lock_key, raw_data, return_value)
|
67
59
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
logger.error(log_msg)
|
60
|
+
# should not happen, but we encountered this few times long time ago
|
61
|
+
unless return_value&.first.is_a?(Integer)
|
62
|
+
return logger.error(log_msg)
|
72
63
|
end
|
64
|
+
|
65
|
+
return_value&.first&.positive? ? logger.info(log_msg) : logger.warn(log_msg)
|
73
66
|
end
|
74
67
|
|
75
68
|
def start_msg
|
data/lib/simple_mutex/mutex.rb
CHANGED
data/lib/simple_mutex/version.rb
CHANGED
data/simple_mutex.gemspec
CHANGED
@@ -36,5 +36,7 @@ Gem::Specification.new do |spec|
|
|
36
36
|
spec.add_development_dependency "rubocop"
|
37
37
|
spec.add_development_dependency "rubocop-config-umbrellio"
|
38
38
|
spec.add_development_dependency "rubocop-rspec"
|
39
|
+
spec.add_development_dependency "simplecov"
|
40
|
+
spec.add_development_dependency "simplecov-lcov"
|
39
41
|
spec.add_development_dependency "timecop"
|
40
42
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_mutex
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- bob-umbr
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-11-
|
11
|
+
date: 2021-11-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|
@@ -150,6 +150,34 @@ dependencies:
|
|
150
150
|
- - ">="
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: simplecov
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ">="
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: simplecov-lcov
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - ">="
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - ">="
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '0'
|
153
181
|
- !ruby/object:Gem::Dependency
|
154
182
|
name: timecop
|
155
183
|
requirement: !ruby/object:Gem::Requirement
|
@@ -171,10 +199,11 @@ executables: []
|
|
171
199
|
extensions: []
|
172
200
|
extra_rdoc_files: []
|
173
201
|
files:
|
174
|
-
- ".github/
|
202
|
+
- ".github/workflows/main.yml"
|
175
203
|
- ".gitignore"
|
176
204
|
- ".rspec"
|
177
205
|
- ".rubocop.yml"
|
206
|
+
- CHANGELOG.md
|
178
207
|
- Gemfile
|
179
208
|
- Gemfile.lock
|
180
209
|
- LICENSE
|
@@ -213,7 +242,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
213
242
|
- !ruby/object:Gem::Version
|
214
243
|
version: '0'
|
215
244
|
requirements: []
|
216
|
-
rubygems_version: 3.3
|
245
|
+
rubygems_version: 3.2.3
|
217
246
|
signing_key:
|
218
247
|
specification_version: 4
|
219
248
|
summary: Redis-based mutex library for using with sidekiq jobs and batches.
|