umbrellio-utils 1.4.0 → 1.5.0
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/workflows/test.yml +1 -1
- data/.rubocop.yml +1 -1
- data/Gemfile +1 -1
- data/Gemfile.lock +99 -110
- data/lib/umbrellio_utils/control.rb +1 -1
- data/lib/umbrellio_utils/database.rb +6 -6
- data/lib/umbrellio_utils/formatting.rb +1 -1
- data/lib/umbrellio_utils/jobs.rb +86 -0
- data/lib/umbrellio_utils/misc.rb +1 -1
- data/lib/umbrellio_utils/parsing.rb +15 -1
- data/lib/umbrellio_utils/vault.rb +1 -1
- data/lib/umbrellio_utils/version.rb +1 -1
- data/lib/umbrellio_utils.rb +3 -2
- data/umbrellio_utils.gemspec +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 16502aeac71a5a8860b3dcd6ea3acbf3714ee86c243b2cfa78ca3356805211dd
|
|
4
|
+
data.tar.gz: 8c9744334c49cf933d1dd2f7b60b5d22cd00468450bbc90971e083479ed9e7db
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 80a4cf07687c9b3c8aa4680533e14977ea7730834ba78393fef5121db2636c971072795145aa42305e41b181a29d48379e9fcb486abd1dd5539e6164441ca0a1
|
|
7
|
+
data.tar.gz: d52ecd94d480776572e2d70be1963b536d6032b2b7c8a9c9547884911825262f405bf6f9d40bc7c1e6577ce7fddd3ef4602395730de370d77b06b5a9174823bb
|
data/.github/workflows/test.yml
CHANGED
data/.rubocop.yml
CHANGED
data/Gemfile
CHANGED
|
@@ -9,7 +9,7 @@ gem "activesupport"
|
|
|
9
9
|
gem "bundler"
|
|
10
10
|
gem "ci-helper"
|
|
11
11
|
gem "http"
|
|
12
|
-
gem "net-pop"
|
|
12
|
+
gem "net-pop"
|
|
13
13
|
gem "nokogiri"
|
|
14
14
|
gem "nori"
|
|
15
15
|
gem "pg"
|
data/Gemfile.lock
CHANGED
|
@@ -1,93 +1,82 @@
|
|
|
1
|
-
GIT
|
|
2
|
-
remote: https://github.com/ruby/net-pop.git
|
|
3
|
-
revision: e8d0afe2773b9eb6a23c39e9e437f6fc0fc7c733
|
|
4
|
-
specs:
|
|
5
|
-
net-pop (0.1.2)
|
|
6
|
-
net-protocol
|
|
7
|
-
|
|
8
1
|
PATH
|
|
9
2
|
remote: .
|
|
10
3
|
specs:
|
|
11
|
-
umbrellio-utils (1.
|
|
4
|
+
umbrellio-utils (1.5.0)
|
|
12
5
|
memery (~> 1)
|
|
13
6
|
|
|
14
7
|
GEM
|
|
15
8
|
remote: https://rubygems.org/
|
|
16
9
|
specs:
|
|
17
|
-
actioncable (7.1
|
|
18
|
-
actionpack (= 7.1
|
|
19
|
-
activesupport (= 7.1
|
|
10
|
+
actioncable (7.2.1)
|
|
11
|
+
actionpack (= 7.2.1)
|
|
12
|
+
activesupport (= 7.2.1)
|
|
20
13
|
nio4r (~> 2.0)
|
|
21
14
|
websocket-driver (>= 0.6.1)
|
|
22
15
|
zeitwerk (~> 2.6)
|
|
23
|
-
actionmailbox (7.1
|
|
24
|
-
actionpack (= 7.1
|
|
25
|
-
activejob (= 7.1
|
|
26
|
-
activerecord (= 7.1
|
|
27
|
-
activestorage (= 7.1
|
|
28
|
-
activesupport (= 7.1
|
|
29
|
-
mail (>= 2.
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
activejob (= 7.1.3.4)
|
|
37
|
-
activesupport (= 7.1.3.4)
|
|
38
|
-
mail (~> 2.5, >= 2.5.4)
|
|
39
|
-
net-imap
|
|
40
|
-
net-pop
|
|
41
|
-
net-smtp
|
|
16
|
+
actionmailbox (7.2.1)
|
|
17
|
+
actionpack (= 7.2.1)
|
|
18
|
+
activejob (= 7.2.1)
|
|
19
|
+
activerecord (= 7.2.1)
|
|
20
|
+
activestorage (= 7.2.1)
|
|
21
|
+
activesupport (= 7.2.1)
|
|
22
|
+
mail (>= 2.8.0)
|
|
23
|
+
actionmailer (7.2.1)
|
|
24
|
+
actionpack (= 7.2.1)
|
|
25
|
+
actionview (= 7.2.1)
|
|
26
|
+
activejob (= 7.2.1)
|
|
27
|
+
activesupport (= 7.2.1)
|
|
28
|
+
mail (>= 2.8.0)
|
|
42
29
|
rails-dom-testing (~> 2.2)
|
|
43
|
-
actionpack (7.1
|
|
44
|
-
actionview (= 7.1
|
|
45
|
-
activesupport (= 7.1
|
|
30
|
+
actionpack (7.2.1)
|
|
31
|
+
actionview (= 7.2.1)
|
|
32
|
+
activesupport (= 7.2.1)
|
|
46
33
|
nokogiri (>= 1.8.5)
|
|
47
34
|
racc
|
|
48
|
-
rack (>= 2.2.4)
|
|
35
|
+
rack (>= 2.2.4, < 3.2)
|
|
49
36
|
rack-session (>= 1.0.1)
|
|
50
37
|
rack-test (>= 0.6.3)
|
|
51
38
|
rails-dom-testing (~> 2.2)
|
|
52
39
|
rails-html-sanitizer (~> 1.6)
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
40
|
+
useragent (~> 0.16)
|
|
41
|
+
actiontext (7.2.1)
|
|
42
|
+
actionpack (= 7.2.1)
|
|
43
|
+
activerecord (= 7.2.1)
|
|
44
|
+
activestorage (= 7.2.1)
|
|
45
|
+
activesupport (= 7.2.1)
|
|
58
46
|
globalid (>= 0.6.0)
|
|
59
47
|
nokogiri (>= 1.8.5)
|
|
60
|
-
actionview (7.1
|
|
61
|
-
activesupport (= 7.1
|
|
48
|
+
actionview (7.2.1)
|
|
49
|
+
activesupport (= 7.2.1)
|
|
62
50
|
builder (~> 3.1)
|
|
63
51
|
erubi (~> 1.11)
|
|
64
52
|
rails-dom-testing (~> 2.2)
|
|
65
53
|
rails-html-sanitizer (~> 1.6)
|
|
66
|
-
activejob (7.1
|
|
67
|
-
activesupport (= 7.1
|
|
54
|
+
activejob (7.2.1)
|
|
55
|
+
activesupport (= 7.2.1)
|
|
68
56
|
globalid (>= 0.3.6)
|
|
69
|
-
activemodel (7.1
|
|
70
|
-
activesupport (= 7.1
|
|
71
|
-
activerecord (7.1
|
|
72
|
-
activemodel (= 7.1
|
|
73
|
-
activesupport (= 7.1
|
|
57
|
+
activemodel (7.2.1)
|
|
58
|
+
activesupport (= 7.2.1)
|
|
59
|
+
activerecord (7.2.1)
|
|
60
|
+
activemodel (= 7.2.1)
|
|
61
|
+
activesupport (= 7.2.1)
|
|
74
62
|
timeout (>= 0.4.0)
|
|
75
|
-
activestorage (7.1
|
|
76
|
-
actionpack (= 7.1
|
|
77
|
-
activejob (= 7.1
|
|
78
|
-
activerecord (= 7.1
|
|
79
|
-
activesupport (= 7.1
|
|
63
|
+
activestorage (7.2.1)
|
|
64
|
+
actionpack (= 7.2.1)
|
|
65
|
+
activejob (= 7.2.1)
|
|
66
|
+
activerecord (= 7.2.1)
|
|
67
|
+
activesupport (= 7.2.1)
|
|
80
68
|
marcel (~> 1.0)
|
|
81
|
-
activesupport (7.1
|
|
69
|
+
activesupport (7.2.1)
|
|
82
70
|
base64
|
|
83
71
|
bigdecimal
|
|
84
|
-
concurrent-ruby (~> 1.0, >= 1.
|
|
72
|
+
concurrent-ruby (~> 1.0, >= 1.3.1)
|
|
85
73
|
connection_pool (>= 2.2.5)
|
|
86
74
|
drb
|
|
87
75
|
i18n (>= 1.6, < 2)
|
|
76
|
+
logger (>= 1.4.2)
|
|
88
77
|
minitest (>= 5.1)
|
|
89
|
-
|
|
90
|
-
tzinfo (~> 2.0)
|
|
78
|
+
securerandom (>= 0.3)
|
|
79
|
+
tzinfo (~> 2.0, >= 2.0.5)
|
|
91
80
|
addressable (2.8.7)
|
|
92
81
|
public_suffix (>= 2.0.2, < 7.0)
|
|
93
82
|
amazing_print (1.6.0)
|
|
@@ -105,12 +94,12 @@ GEM
|
|
|
105
94
|
umbrellio-sequel-plugins (~> 0.14)
|
|
106
95
|
coderay (1.1.3)
|
|
107
96
|
colorize (1.1.0)
|
|
108
|
-
concurrent-ruby (1.3.
|
|
97
|
+
concurrent-ruby (1.3.4)
|
|
109
98
|
connection_pool (2.4.1)
|
|
110
99
|
crass (1.0.6)
|
|
111
100
|
date (3.3.4)
|
|
112
101
|
diff-lcs (1.5.1)
|
|
113
|
-
docile (1.4.
|
|
102
|
+
docile (1.4.1)
|
|
114
103
|
domain_name (0.6.20240107)
|
|
115
104
|
drb (2.2.1)
|
|
116
105
|
dry-inflector (1.1.0)
|
|
@@ -130,22 +119,23 @@ GEM
|
|
|
130
119
|
http-cookie (~> 1.0)
|
|
131
120
|
http-form_data (~> 2.2)
|
|
132
121
|
llhttp-ffi (~> 0.5.0)
|
|
133
|
-
http-cookie (1.0.
|
|
122
|
+
http-cookie (1.0.7)
|
|
134
123
|
domain_name (~> 0.5)
|
|
135
124
|
http-form_data (2.3.0)
|
|
136
125
|
i18n (1.14.5)
|
|
137
126
|
concurrent-ruby (~> 1.0)
|
|
138
127
|
io-console (0.7.2)
|
|
139
|
-
irb (1.
|
|
128
|
+
irb (1.14.0)
|
|
140
129
|
rdoc (>= 4.0.0)
|
|
141
130
|
reline (>= 0.4.2)
|
|
142
131
|
json (2.7.2)
|
|
143
|
-
lamian (1.
|
|
132
|
+
lamian (1.10.0)
|
|
144
133
|
rails (>= 4.2)
|
|
145
134
|
language_server-protocol (3.17.0.3)
|
|
146
135
|
llhttp-ffi (0.5.0)
|
|
147
136
|
ffi-compiler (~> 1.0)
|
|
148
137
|
rake (~> 13.0)
|
|
138
|
+
logger (1.6.1)
|
|
149
139
|
loofah (2.22.0)
|
|
150
140
|
crass (~> 1.0.2)
|
|
151
141
|
nokogiri (>= 1.12.0)
|
|
@@ -160,46 +150,47 @@ GEM
|
|
|
160
150
|
method_source (1.1.0)
|
|
161
151
|
mini_mime (1.1.5)
|
|
162
152
|
mini_portile2 (2.8.7)
|
|
163
|
-
minitest (5.
|
|
164
|
-
|
|
165
|
-
net-imap (0.4.14)
|
|
153
|
+
minitest (5.25.1)
|
|
154
|
+
net-imap (0.4.16)
|
|
166
155
|
date
|
|
167
156
|
net-protocol
|
|
157
|
+
net-pop (0.1.2)
|
|
158
|
+
net-protocol
|
|
168
159
|
net-protocol (0.2.2)
|
|
169
160
|
timeout
|
|
170
161
|
net-smtp (0.5.0)
|
|
171
162
|
net-protocol
|
|
172
163
|
nio4r (2.7.3)
|
|
173
|
-
nokogiri (1.16.
|
|
164
|
+
nokogiri (1.16.7)
|
|
174
165
|
mini_portile2 (~> 2.8.2)
|
|
175
166
|
racc (~> 1.4)
|
|
176
|
-
nokogiri (1.16.
|
|
167
|
+
nokogiri (1.16.7-arm64-darwin)
|
|
177
168
|
racc (~> 1.4)
|
|
178
|
-
nokogiri (1.16.
|
|
169
|
+
nokogiri (1.16.7-x86_64-darwin)
|
|
179
170
|
racc (~> 1.4)
|
|
180
|
-
nokogiri (1.16.
|
|
171
|
+
nokogiri (1.16.7-x86_64-linux)
|
|
181
172
|
racc (~> 1.4)
|
|
182
|
-
nori (2.7.
|
|
173
|
+
nori (2.7.1)
|
|
183
174
|
bigdecimal
|
|
184
|
-
parallel (1.
|
|
185
|
-
parser (3.3.
|
|
175
|
+
parallel (1.26.3)
|
|
176
|
+
parser (3.3.5.0)
|
|
186
177
|
ast (~> 2.4.1)
|
|
187
178
|
racc
|
|
188
|
-
pg (1.5.
|
|
179
|
+
pg (1.5.7)
|
|
189
180
|
pry (0.14.2)
|
|
190
181
|
coderay (~> 1.1)
|
|
191
182
|
method_source (~> 1.0)
|
|
192
183
|
psych (5.1.2)
|
|
193
184
|
stringio
|
|
194
|
-
public_suffix (6.0.
|
|
185
|
+
public_suffix (6.0.1)
|
|
195
186
|
rabbit_messaging (0.15.0)
|
|
196
187
|
bunny (~> 2.0)
|
|
197
188
|
lamian
|
|
198
189
|
rails (>= 5.2)
|
|
199
190
|
sneakers (~> 2.0)
|
|
200
191
|
tainbox
|
|
201
|
-
racc (1.8.
|
|
202
|
-
rack (3.1.
|
|
192
|
+
racc (1.8.1)
|
|
193
|
+
rack (3.1.7)
|
|
203
194
|
rack-session (2.0.0)
|
|
204
195
|
rack (>= 3.0.0)
|
|
205
196
|
rack-test (2.1.0)
|
|
@@ -207,20 +198,20 @@ GEM
|
|
|
207
198
|
rackup (2.1.0)
|
|
208
199
|
rack (>= 3)
|
|
209
200
|
webrick (~> 1.8)
|
|
210
|
-
rails (7.1
|
|
211
|
-
actioncable (= 7.1
|
|
212
|
-
actionmailbox (= 7.1
|
|
213
|
-
actionmailer (= 7.1
|
|
214
|
-
actionpack (= 7.1
|
|
215
|
-
actiontext (= 7.1
|
|
216
|
-
actionview (= 7.1
|
|
217
|
-
activejob (= 7.1
|
|
218
|
-
activemodel (= 7.1
|
|
219
|
-
activerecord (= 7.1
|
|
220
|
-
activestorage (= 7.1
|
|
221
|
-
activesupport (= 7.1
|
|
201
|
+
rails (7.2.1)
|
|
202
|
+
actioncable (= 7.2.1)
|
|
203
|
+
actionmailbox (= 7.2.1)
|
|
204
|
+
actionmailer (= 7.2.1)
|
|
205
|
+
actionpack (= 7.2.1)
|
|
206
|
+
actiontext (= 7.2.1)
|
|
207
|
+
actionview (= 7.2.1)
|
|
208
|
+
activejob (= 7.2.1)
|
|
209
|
+
activemodel (= 7.2.1)
|
|
210
|
+
activerecord (= 7.2.1)
|
|
211
|
+
activestorage (= 7.2.1)
|
|
212
|
+
activesupport (= 7.2.1)
|
|
222
213
|
bundler (>= 1.15.0)
|
|
223
|
-
railties (= 7.1
|
|
214
|
+
railties (= 7.2.1)
|
|
224
215
|
rails-dom-testing (2.2.0)
|
|
225
216
|
activesupport (>= 5.0.0)
|
|
226
217
|
minitest
|
|
@@ -228,10 +219,10 @@ GEM
|
|
|
228
219
|
rails-html-sanitizer (1.6.0)
|
|
229
220
|
loofah (~> 2.21)
|
|
230
221
|
nokogiri (~> 1.14)
|
|
231
|
-
railties (7.1
|
|
232
|
-
actionpack (= 7.1
|
|
233
|
-
activesupport (= 7.1
|
|
234
|
-
irb
|
|
222
|
+
railties (7.2.1)
|
|
223
|
+
actionpack (= 7.2.1)
|
|
224
|
+
activesupport (= 7.2.1)
|
|
225
|
+
irb (~> 1.13)
|
|
235
226
|
rackup (>= 1.0.0)
|
|
236
227
|
rake (>= 12.2)
|
|
237
228
|
thor (~> 1.0, >= 1.2.2)
|
|
@@ -242,17 +233,16 @@ GEM
|
|
|
242
233
|
rdoc (6.7.0)
|
|
243
234
|
psych (>= 4.0.0)
|
|
244
235
|
regexp_parser (2.9.2)
|
|
245
|
-
reline (0.5.
|
|
236
|
+
reline (0.5.10)
|
|
246
237
|
io-console (~> 0.5)
|
|
247
|
-
rexml (3.3.
|
|
248
|
-
strscan
|
|
238
|
+
rexml (3.3.7)
|
|
249
239
|
rspec (3.13.0)
|
|
250
240
|
rspec-core (~> 3.13.0)
|
|
251
241
|
rspec-expectations (~> 3.13.0)
|
|
252
242
|
rspec-mocks (~> 3.13.0)
|
|
253
|
-
rspec-core (3.13.
|
|
243
|
+
rspec-core (3.13.1)
|
|
254
244
|
rspec-support (~> 3.13.0)
|
|
255
|
-
rspec-expectations (3.13.
|
|
245
|
+
rspec-expectations (3.13.2)
|
|
256
246
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
257
247
|
rspec-support (~> 3.13.0)
|
|
258
248
|
rspec-json_matcher (0.2.0)
|
|
@@ -273,7 +263,7 @@ GEM
|
|
|
273
263
|
rubocop-ast (>= 1.31.1, < 2.0)
|
|
274
264
|
ruby-progressbar (~> 1.7)
|
|
275
265
|
unicode-display_width (>= 2.4.0, < 3.0)
|
|
276
|
-
rubocop-ast (1.
|
|
266
|
+
rubocop-ast (1.32.3)
|
|
277
267
|
parser (>= 3.3.1.0)
|
|
278
268
|
rubocop-capybara (2.21.0)
|
|
279
269
|
rubocop (~> 1.41)
|
|
@@ -307,10 +297,11 @@ GEM
|
|
|
307
297
|
rubocop (~> 1.0)
|
|
308
298
|
ruby-progressbar (1.13.0)
|
|
309
299
|
ruby2_keywords (0.0.5)
|
|
300
|
+
securerandom (0.3.1)
|
|
310
301
|
self_data (1.3.0)
|
|
311
|
-
semantic_logger (4.
|
|
302
|
+
semantic_logger (4.16.0)
|
|
312
303
|
concurrent-ruby (~> 1.0)
|
|
313
|
-
sequel (5.
|
|
304
|
+
sequel (5.84.0)
|
|
314
305
|
bigdecimal
|
|
315
306
|
sequel-batches (2.0.2)
|
|
316
307
|
sequel
|
|
@@ -335,8 +326,6 @@ GEM
|
|
|
335
326
|
rbtree
|
|
336
327
|
set (~> 1.0)
|
|
337
328
|
stringio (3.1.1)
|
|
338
|
-
strscan (3.1.0)
|
|
339
|
-
symbiont-ruby (0.7.0)
|
|
340
329
|
table_sync (6.5.0)
|
|
341
330
|
memery
|
|
342
331
|
rabbit_messaging (~> 0.13)
|
|
@@ -344,21 +333,21 @@ GEM
|
|
|
344
333
|
self_data
|
|
345
334
|
tainbox (2.1.2)
|
|
346
335
|
activesupport
|
|
347
|
-
thor (1.3.
|
|
336
|
+
thor (1.3.2)
|
|
348
337
|
timecop (0.9.10)
|
|
349
338
|
timeout (0.4.1)
|
|
350
339
|
tzinfo (2.0.6)
|
|
351
340
|
concurrent-ruby (~> 1.0)
|
|
352
|
-
umbrellio-sequel-plugins (0.
|
|
341
|
+
umbrellio-sequel-plugins (0.16.0.211)
|
|
353
342
|
sequel
|
|
354
|
-
symbiont-ruby
|
|
355
343
|
unicode-display_width (2.5.0)
|
|
344
|
+
useragent (0.16.10)
|
|
356
345
|
webrick (1.8.1)
|
|
357
346
|
websocket-driver (0.7.6)
|
|
358
347
|
websocket-extensions (>= 0.1.0)
|
|
359
348
|
websocket-extensions (0.1.5)
|
|
360
|
-
yard (0.9.
|
|
361
|
-
zeitwerk (2.6.
|
|
349
|
+
yard (0.9.37)
|
|
350
|
+
zeitwerk (2.6.18)
|
|
362
351
|
|
|
363
352
|
PLATFORMS
|
|
364
353
|
arm64-darwin-20
|
|
@@ -373,7 +362,7 @@ DEPENDENCIES
|
|
|
373
362
|
bundler
|
|
374
363
|
ci-helper
|
|
375
364
|
http
|
|
376
|
-
net-pop
|
|
365
|
+
net-pop
|
|
377
366
|
nokogiri
|
|
378
367
|
nori
|
|
379
368
|
pg
|
|
@@ -393,4 +382,4 @@ DEPENDENCIES
|
|
|
393
382
|
yard
|
|
394
383
|
|
|
395
384
|
BUNDLED WITH
|
|
396
|
-
2.5.
|
|
385
|
+
2.5.18
|
|
@@ -21,7 +21,7 @@ module UmbrellioUtils
|
|
|
21
21
|
def retry_on_unique_violation(
|
|
22
22
|
times: Float::INFINITY, retry_on_all_constraints: false, checked_constraints: [], &block
|
|
23
23
|
)
|
|
24
|
-
retry_on(Sequel::UniqueConstraintViolation, times:
|
|
24
|
+
retry_on(Sequel::UniqueConstraintViolation, times:) do
|
|
25
25
|
DB.transaction(savepoint: true, &block)
|
|
26
26
|
rescue Sequel::UniqueConstraintViolation => e
|
|
27
27
|
constraint_name = Database.get_violated_constraint_name(e)
|
|
@@ -7,8 +7,8 @@ module UmbrellioUtils
|
|
|
7
7
|
HandledConstaintError = Class.new(StandardError)
|
|
8
8
|
InvalidPkError = Class.new(StandardError)
|
|
9
9
|
|
|
10
|
-
def handle_constraint_error(constraint_name, &
|
|
11
|
-
DB.transaction(savepoint: true, &
|
|
10
|
+
def handle_constraint_error(constraint_name, &)
|
|
11
|
+
DB.transaction(savepoint: true, &)
|
|
12
12
|
rescue Sequel::UniqueConstraintViolation => e
|
|
13
13
|
if constraint_name.to_s == get_violated_constraint_name(e)
|
|
14
14
|
raise HandledConstaintError
|
|
@@ -23,7 +23,7 @@ module UmbrellioUtils
|
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
def each_record(dataset, primary_key: nil, **options, &block)
|
|
26
|
-
primary_key = primary_key_from(dataset, primary_key:
|
|
26
|
+
primary_key = primary_key_from(dataset, primary_key:)
|
|
27
27
|
|
|
28
28
|
with_temp_table(dataset, **options) do |ids|
|
|
29
29
|
rows = ids.map { |id| row(id.is_a?(Hash) ? id.values : [id]) }
|
|
@@ -47,11 +47,11 @@ module UmbrellioUtils
|
|
|
47
47
|
primary_key: nil,
|
|
48
48
|
temp_table_name: nil
|
|
49
49
|
)
|
|
50
|
-
primary_key = primary_key_from(dataset, primary_key:
|
|
50
|
+
primary_key = primary_key_from(dataset, primary_key:)
|
|
51
51
|
sleep_interval = sleep_interval_from(sleep)
|
|
52
52
|
|
|
53
53
|
temp_table_name = create_temp_table(
|
|
54
|
-
dataset, primary_key
|
|
54
|
+
dataset, primary_key:, temp_table_name: temp_table_name&.to_sym
|
|
55
55
|
)
|
|
56
56
|
|
|
57
57
|
pk_set = []
|
|
@@ -77,7 +77,7 @@ module UmbrellioUtils
|
|
|
77
77
|
temp_table_name ||= :"temp_#{model.table_name}_#{time.to_i}_#{time.nsec}"
|
|
78
78
|
return temp_table_name if DB.table_exists?(temp_table_name)
|
|
79
79
|
|
|
80
|
-
primary_key = primary_key_from(dataset, primary_key:
|
|
80
|
+
primary_key = primary_key_from(dataset, primary_key:)
|
|
81
81
|
|
|
82
82
|
DB.create_table(temp_table_name, unlogged: true) do
|
|
83
83
|
primary_key.each do |field|
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module UmbrellioUtils::Jobs
|
|
4
|
+
extend self
|
|
5
|
+
|
|
6
|
+
Worker = Struct.new(:name)
|
|
7
|
+
Capsule = Struct.new(:name, :worker, :weight)
|
|
8
|
+
Queue = Struct.new(:name, :capsule, :weight)
|
|
9
|
+
Entry = Struct.new(:capsule, :queues, :concurrency)
|
|
10
|
+
|
|
11
|
+
def workers
|
|
12
|
+
@workers ||= []
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def capsules
|
|
16
|
+
@capsules ||= []
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def queues
|
|
20
|
+
@queues ||= []
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def register_worker(name)
|
|
24
|
+
workers << Worker.new(name)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def register_capsule(name, worker: :default, weight: 1)
|
|
28
|
+
workers.find { |x| x.name == worker } or raise "Worker not found: #{worker.inspect}"
|
|
29
|
+
capsules << Capsule.new(name, worker, weight)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def register_queue(name, capsule: :default, weight: 1)
|
|
33
|
+
capsules.find { |x| x.name == capsule } or raise "Capsule not found: #{capsule.inspect}"
|
|
34
|
+
queues << Queue.new(name, capsule, weight)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def retry_interval(error_count, min_interval:, max_interval:)
|
|
38
|
+
interval = min_interval * (1.3**(error_count - 3))
|
|
39
|
+
interval.clamp(min_interval, max_interval).round
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def configure_capsules!(config, priority_level:, max_concurrency:)
|
|
43
|
+
entries = capsules_for(priority_level, max_concurrency)
|
|
44
|
+
|
|
45
|
+
unless entries.find { |x| x.capsule == :default }
|
|
46
|
+
entries.last.capsule = :default # Default capsule should always be present in sidekiq
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
entries.each do |entry|
|
|
50
|
+
config.capsule(entry.capsule) do |capsule|
|
|
51
|
+
capsule.queues = entry.queues
|
|
52
|
+
capsule.concurrency = entry.concurrency
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def capsules_for(worker, max_concurrency)
|
|
58
|
+
capsules = self.capsules.select do |capsule|
|
|
59
|
+
next unless capsule.worker.to_s == worker.underscore.to_s
|
|
60
|
+
next unless queues.any? { |queue| queue.capsule == capsule.name }
|
|
61
|
+
true
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
total_weight = capsules.sum(&:weight)
|
|
65
|
+
|
|
66
|
+
result = capsules.filter_map do |capsule|
|
|
67
|
+
weight_coef = capsule.weight / total_weight.to_f
|
|
68
|
+
concurrency = (max_concurrency * weight_coef).to_i
|
|
69
|
+
concurrency = 1 unless concurrency > 1
|
|
70
|
+
queues = self.queues.select { |x| x.capsule == capsule.name }.map { |x| [x.name, x.weight] }
|
|
71
|
+
Entry.new(capsule.name, queues, concurrency)
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
raise "No queues found for worker #{worker.inspect}" if result.empty?
|
|
75
|
+
|
|
76
|
+
result
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def validate_queue_name!(queue_name)
|
|
80
|
+
found = queues.any? do |queue|
|
|
81
|
+
queue.name.to_s == queue_name.to_s
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
raise "Unknown queue: #{queue_name.inspect}" unless found
|
|
85
|
+
end
|
|
86
|
+
end
|
data/lib/umbrellio_utils/misc.rb
CHANGED
|
@@ -20,7 +20,7 @@ module UmbrellioUtils
|
|
|
20
20
|
xml.remove_namespaces!
|
|
21
21
|
xml.xpath("//@*").remove if remove_attributes
|
|
22
22
|
|
|
23
|
-
tags_converter = snakecase ? -> (tag) { tag.
|
|
23
|
+
tags_converter = snakecase ? -> (tag) { snakecase(tag).to_sym } : -> (tag) { tag.to_sym }
|
|
24
24
|
nori = Nori.new(convert_tags_to: tags_converter, convert_dashes_to_underscores: false)
|
|
25
25
|
nori.parse(xml.to_xml(save_with: Nokogiri::XML::Node::SaveOptions::NO_DECLARATION))
|
|
26
26
|
end
|
|
@@ -72,5 +72,19 @@ module UmbrellioUtils
|
|
|
72
72
|
|
|
73
73
|
phone.sanitized
|
|
74
74
|
end
|
|
75
|
+
|
|
76
|
+
private
|
|
77
|
+
|
|
78
|
+
# See https://github.com/savonrb/nori/blob/main/lib/nori/string_utils.rb
|
|
79
|
+
def snakecase(string)
|
|
80
|
+
str = string.dup
|
|
81
|
+
str.gsub!("::", "/")
|
|
82
|
+
str.gsub!(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
|
|
83
|
+
str.gsub!(/([a-z\d])([A-Z])/, '\1_\2')
|
|
84
|
+
str.tr!(".", "_")
|
|
85
|
+
str.tr!("-", "_")
|
|
86
|
+
str.downcase!
|
|
87
|
+
str
|
|
88
|
+
end
|
|
75
89
|
end
|
|
76
90
|
end
|
|
@@ -22,7 +22,7 @@ module UmbrellioUtils
|
|
|
22
22
|
def write_to_kv(engine_path:, secret_path:, data:)
|
|
23
23
|
full_data_path = File.join(engine_path, "data", secret_path)
|
|
24
24
|
full_meta_path = File.join(engine_path, "metadata", secret_path)
|
|
25
|
-
::Vault.logical.write(full_data_path, data:
|
|
25
|
+
::Vault.logical.write(full_data_path, data:)
|
|
26
26
|
::Vault.logical.write(full_meta_path, id: secret_path, max_versions: 1, cas_required: false)
|
|
27
27
|
end
|
|
28
28
|
end
|
data/lib/umbrellio_utils.rb
CHANGED
|
@@ -41,8 +41,8 @@ module UmbrellioUtils
|
|
|
41
41
|
}
|
|
42
42
|
end
|
|
43
43
|
|
|
44
|
-
def synchronize(&
|
|
45
|
-
GLOBAL_MUTEX.owned? ? yield : GLOBAL_MUTEX.synchronize(&
|
|
44
|
+
def synchronize(&)
|
|
45
|
+
GLOBAL_MUTEX.owned? ? yield : GLOBAL_MUTEX.synchronize(&)
|
|
46
46
|
end
|
|
47
47
|
end
|
|
48
48
|
|
|
@@ -53,6 +53,7 @@ require_relative "umbrellio_utils/control"
|
|
|
53
53
|
require_relative "umbrellio_utils/database"
|
|
54
54
|
require_relative "umbrellio_utils/formatting"
|
|
55
55
|
require_relative "umbrellio_utils/http_client"
|
|
56
|
+
require_relative "umbrellio_utils/jobs"
|
|
56
57
|
require_relative "umbrellio_utils/misc"
|
|
57
58
|
require_relative "umbrellio_utils/parsing"
|
|
58
59
|
require_relative "umbrellio_utils/passwords"
|
data/umbrellio_utils.gemspec
CHANGED
|
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
|
|
|
12
12
|
spec.description = "UmbrellioUtils is collection of utility classes and helpers"
|
|
13
13
|
spec.homepage = "https://github.com/umbrellio/utils"
|
|
14
14
|
spec.license = "MIT"
|
|
15
|
-
spec.required_ruby_version = Gem::Requirement.new(">= 3.
|
|
15
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 3.1.0")
|
|
16
16
|
|
|
17
17
|
spec.metadata["homepage_uri"] = spec.homepage
|
|
18
18
|
spec.metadata["source_code_uri"] = "https://github.com/umbrellio/utils"
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: umbrellio-utils
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Team Umbrellio
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2024-
|
|
11
|
+
date: 2024-09-06 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: memery
|
|
@@ -52,6 +52,7 @@ files:
|
|
|
52
52
|
- lib/umbrellio_utils/database.rb
|
|
53
53
|
- lib/umbrellio_utils/formatting.rb
|
|
54
54
|
- lib/umbrellio_utils/http_client.rb
|
|
55
|
+
- lib/umbrellio_utils/jobs.rb
|
|
55
56
|
- lib/umbrellio_utils/misc.rb
|
|
56
57
|
- lib/umbrellio_utils/parsing.rb
|
|
57
58
|
- lib/umbrellio_utils/passwords.rb
|
|
@@ -79,14 +80,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
79
80
|
requirements:
|
|
80
81
|
- - ">="
|
|
81
82
|
- !ruby/object:Gem::Version
|
|
82
|
-
version: 3.
|
|
83
|
+
version: 3.1.0
|
|
83
84
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
84
85
|
requirements:
|
|
85
86
|
- - ">="
|
|
86
87
|
- !ruby/object:Gem::Version
|
|
87
88
|
version: '0'
|
|
88
89
|
requirements: []
|
|
89
|
-
rubygems_version: 3.5.
|
|
90
|
+
rubygems_version: 3.5.18
|
|
90
91
|
signing_key:
|
|
91
92
|
specification_version: 4
|
|
92
93
|
summary: A set of utilities that speed up development
|