work_shaper 0.1.2 → 0.1.2.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
2
  SHA256:
3
- metadata.gz: 357d650ad73cfb685d1fd05a2ed98a0b4136358dc232febe04be921f8954855c
4
- data.tar.gz: 77bceccf96220ec5ba98e438fde84761dd3494878fae05005cccdad0121cb833
3
+ metadata.gz: 5cd87f9d88041bc67137b36d582629575ec11bb992e3ff9de8611237cfdd56a3
4
+ data.tar.gz: 5c3ad4dee1e236c9c3ab59c15ccaf95716387c9ecaccbc7e45616d6465e8f350
5
5
  SHA512:
6
- metadata.gz: 25c75b8e97b6e320e57164a2128ab320b23efe22c81d3e3f64857e70f92ee3dd881133060b702109ec1b172120a446ffb8d214a0423a039eb95ac4a6d06b3de3
7
- data.tar.gz: 72babc90aaef951eb50dcc3edea4bc71903497bc79aaf3c7708fc143649407a88d4df6240d5f3b232a60fc37f11446f758109d833bc65d0822a23578b2da7ee6
6
+ metadata.gz: fbf7d11372a4d8e69292a82729636fd8bad0bffd1bfa87eae270004648e9beb508ae9d446141cecf09798f306cc5af71a1acec7d9d1d81c09ae93fabf5aa70af
7
+ data.tar.gz: 25195a7ccafaa687d09967d9d9efa2f066edc9b89503b30d62d3e68877518a3c753065de67374de56acf05017731a586ef0a2516510815ebc9a23fa44aea5713
data/Gemfile CHANGED
@@ -10,3 +10,9 @@ gem "rake", "~> 13.0"
10
10
  gem "rspec", "~> 3.0"
11
11
 
12
12
  gem "rubocop", "~> 1.21"
13
+
14
+ gem "sorted_set", "~> 1.0"
15
+
16
+ gem "logger", "~> 1.4"
17
+
18
+ gem "concurrent-ruby", "~> 1.2"
@@ -98,7 +98,8 @@ module WorkShaper
98
98
  total_acked: @total_acked,
99
99
  in_flight: (@total_enqueued.to_i - @total_acked.to_i),
100
100
  last_acked_offsets: @last_ack,
101
- worker_count: @workers.keys.count
101
+ worker_count: @workers.keys.count,
102
+ offset_mgr: @offset_manager.status
102
103
  })
103
104
  if detailed
104
105
  WorkShaper.logger.info(
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module WorkShaper
4
- VERSION = "0.1.2"
4
+ VERSION = "0.1.2.1"
5
5
  end
@@ -27,16 +27,14 @@ module WorkShaper
27
27
  @thread_pool.post do
28
28
  @work.call(message, partition, offset)
29
29
  @on_done.call(message, partition, offset)
30
+ rescue => e
31
+ WorkShaper.logger.error("Error processing #{partition}:#{offset} #{e}")
32
+ WorkShaper.logger.error(e.backtrace.join(" > "))
33
+ @on_error.call(e, message, partition, offset)
34
+ ensure
30
35
  @semaphore.synchronize do
31
36
  (@completed_offsets[partition] ||= SortedSet.new) << offset
32
37
  end
33
- # @ack_handler.call(partition, offset)
34
- rescue => e
35
- puts("Error processing #{partition}:#{offset} #{e}")
36
- puts(e.backtrace.join("\n"))
37
- # logger.error("Acking it anyways, why not?")
38
- @on_error.call(e, message, partition, offset)
39
- # @ack_handler.call(partition, offset)
40
38
  end
41
39
  # rubocop:enable Style/RescueStandardError
42
40
  end
data/lib/work_shaper.rb CHANGED
@@ -1,5 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'logger'
4
+ require 'sorted_set'
5
+ require 'concurrent-ruby'
3
6
  require_relative "work_shaper/version"
4
7
  require_relative "work_shaper/manager"
5
8
  require_relative "work_shaper/worker"
data/work_shaper.gemspec CHANGED
@@ -33,6 +33,7 @@ Gem::Specification.new do |spec|
33
33
 
34
34
  # Uncomment to register a new dependency of your gem
35
35
  spec.add_dependency "sorted_set", "~> 1.0"
36
+ spec.add_dependency "concurrent-ruby", "~> 1.2"
36
37
 
37
38
  # For more information and examples about making a new gem, check out our
38
39
  # guide at: https://bundler.io/guides/creating_gem.html
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: work_shaper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jerry Fernholz
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-01-05 00:00:00.000000000 Z
11
+ date: 2024-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sorted_set
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: concurrent-ruby
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.2'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.2'
27
41
  description: WorkShaper was built to parallelize the work needed to process Kafka
28
42
  messages.
29
43
  email: