miteru 2.3.2 → 2.4.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
2
  SHA256:
3
- metadata.gz: dd3ba5f3cd08b4af7eb269c458323f65214491a6111a4d5277b0102913629a77
4
- data.tar.gz: 47542263b5b2e60e5dfadf149d15bac3446f00b5e8aec15e9c83f60629328546
3
+ metadata.gz: a1a624406c34f6f2c4fd913029a408145cd4d24b4151914e9b9e366a48882ade
4
+ data.tar.gz: 745cb186ac2e294acaefb886f3cfd1e8b2c28d8ec19f9021844c823c9d1114c7
5
5
  SHA512:
6
- metadata.gz: '028f612c45b87b4b9ec30cffad2168ec6b3983756e9bdd865835a38ba3c9533ccbe6238240f263f9f1cbf460cad8347e3ed1ec00623ef6cdbb1cfa4ebcf5da47'
7
- data.tar.gz: bc1a770f94eda268ce90735a80d6b45fd6e2f3a900300de52c1499debf15d5e6f7e705d8e7bee068a5234d0f7cf744f6167a50c61914438be78fb68bed38a8e9
6
+ metadata.gz: 952e2b6379e775cfe6c8a7d3ec9c837ed1fb96408a3156edac20cc24c308c96263bb2f0b8e7128b4ee1c8607a2f2b77b4989ee4c826c88a5ffc72acc40f40b67
7
+ data.tar.gz: efed521f1f6fac24b7966e5f5dfbf321f98acfae6e80afa94b7661bfe12be7f4d709e9ad4344301ebe184c8d7a17261e771490d1921972203b2c2a4b25bee306
data/lib/miteru/config.rb CHANGED
@@ -28,6 +28,8 @@ module Miteru
28
28
  sentry_trace_sample_rate: 0.25,
29
29
  sidekiq_redis_url: nil,
30
30
  sidekiq_job_retry: 0,
31
+ sidekiq_batch_size: 50,
32
+ sidekiq_job_timeout: 600,
31
33
  cache_redis_url: nil,
32
34
  cache_ex: nil,
33
35
  cache_prefix: "miteru:cache",
@@ -53,6 +55,12 @@ module Miteru
53
55
  # @!attribute [r] sidekiq_job_retry
54
56
  # @return [Integer]
55
57
 
58
+ # @!attribute [r] sidekiq_batch_size
59
+ # @return [Integer]
60
+
61
+ # @!attribute [r] sidekiq_job_timeout
62
+ # @return [Integer]
63
+
56
64
  # @!attribute [r] cache_redis_url
57
65
  # @return [String, nil]
58
66
 
@@ -13,10 +13,8 @@ module Miteru
13
13
  end
14
14
 
15
15
  def sidekiq_call
16
- non_cached_websites.each do |website|
17
- Jobs::CrawleJob.perform_async(website.url, website.source)
18
- logger.info("Website:#{website.truncated_url} crawler job queued.") if verbose?
19
- end
16
+ array_of_args = non_cached_websites.map { |website| [website.url, website.source] }
17
+ Jobs::CrawleJob.perform_bulk(array_of_args, batch_size: Miteru.config.sidekiq_batch_size)
20
18
  end
21
19
 
22
20
  def parallel_call
@@ -6,7 +6,10 @@ require "miteru/sidekiq/jobs"
6
6
 
7
7
  Sidekiq.configure_server do |config|
8
8
  config.redis = {url: Miteru.config.sidekiq_redis_url.to_s}
9
- config.default_job_options = {"retry" => Miteru.config.sidekiq_job_retry}
9
+ config.default_job_options = {
10
+ retry: Miteru.config.sidekiq_job_retry,
11
+ expires_in: 0.second
12
+ }
10
13
  end
11
14
 
12
15
  Sidekiq.configure_client do |config|
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "sidekiq"
4
+ require "timeout"
4
5
 
5
6
  module Miteru
6
7
  module Jobs
@@ -14,12 +15,15 @@ module Miteru
14
15
  #
15
16
  def perform(url, source)
16
17
  website = Miteru::Website.new(url, source:)
18
+
17
19
  with_db_connection do
18
- result = Crawler.result(website)
19
- if result.success?
20
- Miteru.logger.info("Crawler:#{website.truncated_url} succeeded.")
21
- else
22
- Miteru.logger.info("Crawler:#{website.truncated_url} failed - #{result.failure}.")
20
+ Timeout.timeout(Miteru.config.sidekiq_job_timeout) do
21
+ result = Crawler.result(website)
22
+ if result.success?
23
+ Miteru.logger.info("Crawler:#{website.truncated_url} succeeded.")
24
+ else
25
+ Miteru.logger.info("Crawler:#{website.truncated_url} failed - #{result.failure}.")
26
+ end
23
27
  end
24
28
  end
25
29
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Miteru
4
- VERSION = "2.3.2"
4
+ VERSION = "2.4.0"
5
5
  end
data/miteru.gemspec CHANGED
@@ -30,20 +30,20 @@ Gem::Specification.new do |spec|
30
30
  spec.add_development_dependency "coveralls_reborn", "~> 0.28"
31
31
  spec.add_development_dependency "fuubar", "~> 2.5.1"
32
32
  spec.add_development_dependency "mysql2", "~> 0.5.6"
33
- spec.add_development_dependency "pg", "~> 1.5.8"
33
+ spec.add_development_dependency "pg", "~> 1.5.9"
34
34
  spec.add_development_dependency "rake", "~> 13.2.1"
35
35
  spec.add_development_dependency "rspec", "~> 3.13"
36
36
  spec.add_development_dependency "simplecov-lcov", "~> 0.8"
37
- spec.add_development_dependency "standard", "~> 1.40.0"
37
+ spec.add_development_dependency "standard", "~> 1.41.1"
38
38
  spec.add_development_dependency "test-prof", "~> 1.4.2"
39
39
  spec.add_development_dependency "vcr", "~> 6.3.1"
40
- spec.add_development_dependency "webmock", "~> 3.23.1"
40
+ spec.add_development_dependency "webmock", "~> 3.24.0"
41
41
 
42
- spec.add_dependency "activerecord", "7.2.1"
42
+ spec.add_dependency "activerecord", "7.2.2"
43
43
  spec.add_dependency "addressable", "2.8.7"
44
44
  spec.add_dependency "anyway_config", "2.6.4"
45
45
  spec.add_dependency "colorize", "1.1.0"
46
- spec.add_dependency "dotenv", "3.1.2"
46
+ spec.add_dependency "dotenv", "3.1.4"
47
47
  spec.add_dependency "down", "5.4.2"
48
48
  spec.add_dependency "dry-files", "1.1.0"
49
49
  spec.add_dependency "dry-monads", "1.6.0"
@@ -51,15 +51,15 @@ Gem::Specification.new do |spec|
51
51
  spec.add_dependency "memo_wise", "1.9.0"
52
52
  spec.add_dependency "oga", "3.4"
53
53
  spec.add_dependency "parallel", "1.26.3"
54
- spec.add_dependency "puma", "6.4.2"
55
- spec.add_dependency "rack", "3.1.7"
54
+ spec.add_dependency "puma", "6.4.3"
55
+ spec.add_dependency "rack", "3.1.8"
56
56
  spec.add_dependency "rack-session", "2.0.0"
57
- spec.add_dependency "rackup", "2.1.0"
57
+ spec.add_dependency "rackup", "2.2.0"
58
58
  spec.add_dependency "redis", "5.3.0"
59
59
  spec.add_dependency "semantic_logger", "4.16.1"
60
- spec.add_dependency "sentry-ruby", "5.19.0"
61
- spec.add_dependency "sentry-sidekiq", "5.19.0"
62
- spec.add_dependency "sidekiq", "7.3.2"
60
+ spec.add_dependency "sentry-ruby", "5.21.0"
61
+ spec.add_dependency "sentry-sidekiq", "5.21.0"
62
+ spec.add_dependency "sidekiq", "7.3.4"
63
63
  spec.add_dependency "slack-notifier", "2.4.0"
64
64
  spec.add_dependency "sqlite3", "1.7.2"
65
65
  spec.add_dependency "thor", "1.3.2"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: miteru
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.2
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Manabu Niseki
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-09-10 00:00:00.000000000 Z
11
+ date: 2024-11-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: 1.5.8
89
+ version: 1.5.9
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: 1.5.8
96
+ version: 1.5.9
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rake
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -142,14 +142,14 @@ dependencies:
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: 1.40.0
145
+ version: 1.41.1
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: 1.40.0
152
+ version: 1.41.1
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: test-prof
155
155
  requirement: !ruby/object:Gem::Requirement
@@ -184,28 +184,28 @@ dependencies:
184
184
  requirements:
185
185
  - - "~>"
186
186
  - !ruby/object:Gem::Version
187
- version: 3.23.1
187
+ version: 3.24.0
188
188
  type: :development
189
189
  prerelease: false
190
190
  version_requirements: !ruby/object:Gem::Requirement
191
191
  requirements:
192
192
  - - "~>"
193
193
  - !ruby/object:Gem::Version
194
- version: 3.23.1
194
+ version: 3.24.0
195
195
  - !ruby/object:Gem::Dependency
196
196
  name: activerecord
197
197
  requirement: !ruby/object:Gem::Requirement
198
198
  requirements:
199
199
  - - '='
200
200
  - !ruby/object:Gem::Version
201
- version: 7.2.1
201
+ version: 7.2.2
202
202
  type: :runtime
203
203
  prerelease: false
204
204
  version_requirements: !ruby/object:Gem::Requirement
205
205
  requirements:
206
206
  - - '='
207
207
  - !ruby/object:Gem::Version
208
- version: 7.2.1
208
+ version: 7.2.2
209
209
  - !ruby/object:Gem::Dependency
210
210
  name: addressable
211
211
  requirement: !ruby/object:Gem::Requirement
@@ -254,14 +254,14 @@ dependencies:
254
254
  requirements:
255
255
  - - '='
256
256
  - !ruby/object:Gem::Version
257
- version: 3.1.2
257
+ version: 3.1.4
258
258
  type: :runtime
259
259
  prerelease: false
260
260
  version_requirements: !ruby/object:Gem::Requirement
261
261
  requirements:
262
262
  - - '='
263
263
  - !ruby/object:Gem::Version
264
- version: 3.1.2
264
+ version: 3.1.4
265
265
  - !ruby/object:Gem::Dependency
266
266
  name: down
267
267
  requirement: !ruby/object:Gem::Requirement
@@ -366,28 +366,28 @@ dependencies:
366
366
  requirements:
367
367
  - - '='
368
368
  - !ruby/object:Gem::Version
369
- version: 6.4.2
369
+ version: 6.4.3
370
370
  type: :runtime
371
371
  prerelease: false
372
372
  version_requirements: !ruby/object:Gem::Requirement
373
373
  requirements:
374
374
  - - '='
375
375
  - !ruby/object:Gem::Version
376
- version: 6.4.2
376
+ version: 6.4.3
377
377
  - !ruby/object:Gem::Dependency
378
378
  name: rack
379
379
  requirement: !ruby/object:Gem::Requirement
380
380
  requirements:
381
381
  - - '='
382
382
  - !ruby/object:Gem::Version
383
- version: 3.1.7
383
+ version: 3.1.8
384
384
  type: :runtime
385
385
  prerelease: false
386
386
  version_requirements: !ruby/object:Gem::Requirement
387
387
  requirements:
388
388
  - - '='
389
389
  - !ruby/object:Gem::Version
390
- version: 3.1.7
390
+ version: 3.1.8
391
391
  - !ruby/object:Gem::Dependency
392
392
  name: rack-session
393
393
  requirement: !ruby/object:Gem::Requirement
@@ -408,14 +408,14 @@ dependencies:
408
408
  requirements:
409
409
  - - '='
410
410
  - !ruby/object:Gem::Version
411
- version: 2.1.0
411
+ version: 2.2.0
412
412
  type: :runtime
413
413
  prerelease: false
414
414
  version_requirements: !ruby/object:Gem::Requirement
415
415
  requirements:
416
416
  - - '='
417
417
  - !ruby/object:Gem::Version
418
- version: 2.1.0
418
+ version: 2.2.0
419
419
  - !ruby/object:Gem::Dependency
420
420
  name: redis
421
421
  requirement: !ruby/object:Gem::Requirement
@@ -450,42 +450,42 @@ dependencies:
450
450
  requirements:
451
451
  - - '='
452
452
  - !ruby/object:Gem::Version
453
- version: 5.19.0
453
+ version: 5.21.0
454
454
  type: :runtime
455
455
  prerelease: false
456
456
  version_requirements: !ruby/object:Gem::Requirement
457
457
  requirements:
458
458
  - - '='
459
459
  - !ruby/object:Gem::Version
460
- version: 5.19.0
460
+ version: 5.21.0
461
461
  - !ruby/object:Gem::Dependency
462
462
  name: sentry-sidekiq
463
463
  requirement: !ruby/object:Gem::Requirement
464
464
  requirements:
465
465
  - - '='
466
466
  - !ruby/object:Gem::Version
467
- version: 5.19.0
467
+ version: 5.21.0
468
468
  type: :runtime
469
469
  prerelease: false
470
470
  version_requirements: !ruby/object:Gem::Requirement
471
471
  requirements:
472
472
  - - '='
473
473
  - !ruby/object:Gem::Version
474
- version: 5.19.0
474
+ version: 5.21.0
475
475
  - !ruby/object:Gem::Dependency
476
476
  name: sidekiq
477
477
  requirement: !ruby/object:Gem::Requirement
478
478
  requirements:
479
479
  - - '='
480
480
  - !ruby/object:Gem::Version
481
- version: 7.3.2
481
+ version: 7.3.4
482
482
  type: :runtime
483
483
  prerelease: false
484
484
  version_requirements: !ruby/object:Gem::Requirement
485
485
  requirements:
486
486
  - - '='
487
487
  - !ruby/object:Gem::Version
488
- version: 7.3.2
488
+ version: 7.3.4
489
489
  - !ruby/object:Gem::Dependency
490
490
  name: slack-notifier
491
491
  requirement: !ruby/object:Gem::Requirement