Skip to content

Commit

Permalink
Merge pull request #124 from cookpad/r/remove-shutdown
Browse files Browse the repository at this point in the history
Update producers shutdown call
  • Loading branch information
robertomiranda authored Apr 25, 2024
2 parents 45eaf82 + 9f1b170 commit ab5421d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ jobs:
matrix:
ruby:
- 'head'
- '3.2'
- '3.1'
- '3.0'
- '2.7'
continue-on-error: ${{ matrix.ruby == 'head' }}
name: Ruby ${{ matrix.ruby }}

steps:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
Expand Down
6 changes: 3 additions & 3 deletions lib/streamy/message_buses/kafka_message_bus.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ def deliver(key:, topic:, payload:, priority:)
end

def shutdown
async_producer.shutdown if async_producer?
sync_producers.map(&:shutdown)
async_producer.close if async_producer?
sync_producers.map(&:close)
end

private
Expand All @@ -48,7 +48,7 @@ def async_producer
end

def async_producer?
@_async_producer.present?
!!@_async_producer
end

def sync_producer
Expand Down
2 changes: 1 addition & 1 deletion streamy.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Gem::Specification.new do |spec| # rubocop:disable Metrics/BlockLength
spec.add_development_dependency "capybara"
spec.add_development_dependency "minitest", "~> 5.0"
spec.add_development_dependency "minitest-focus"
spec.add_development_dependency "mocha", "~> 1.4"
spec.add_development_dependency "mocha", "~> 2.0"
spec.add_development_dependency "pry", "~> 0.11"
spec.add_development_dependency "rake", ">= 12.3.3"
spec.add_development_dependency "rspec"
Expand Down
4 changes: 2 additions & 2 deletions test/message_buses/kafka_message_bus_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,15 @@ def test_config_overrides
def test_sync_producer_shutdown
example_delivery(:essential)

producer.expects(:shutdown)
producer.expects(:close)

bus.shutdown
end

def test_async_producer_shutdown
example_delivery(:standard)

producer.expects(:shutdown)
producer.expects(:close)

bus.shutdown
end
Expand Down

0 comments on commit ab5421d

Please sign in to comment.