Skip to content

Commit

Permalink
server: remove codes for async v1.x (#4771)
Browse files Browse the repository at this point in the history
**Which issue(s) this PR fixes**: 
Fixes #

**What this PR does / why we need it**: 
Async v2.0 just supports Ruby 3.1 or above.
When we had been supporting Ruby 2.7 and 3.0, we need async v1.x and
v2.x both.
Related to #4619

Next fluentd version will drop support of Ruby 3.1 or below.
So, now we can remove the codes for async v1.x
Ref. #4745

**Docs Changes**:

**Release Note**:

Signed-off-by: Shizuo Fujita <[email protected]>
  • Loading branch information
Watson1978 authored Jan 16, 2025
1 parent b58c3f0 commit ba5b206
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
2 changes: 1 addition & 1 deletion fluentd.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Gem::Specification.new do |gem|
gem.add_development_dependency("test-unit", ["~> 3.3"])
gem.add_development_dependency("test-unit-rr", ["~> 1.0"])
gem.add_development_dependency("oj", [">= 2.14", "< 4"])
gem.add_development_dependency("async-http", ">= 0.50.0")
gem.add_development_dependency("async-http", "~> 0.86")
gem.add_development_dependency("aws-sigv4", ["~> 1.8"])
gem.add_development_dependency("aws-sdk-core", ["~> 3.191"])
gem.add_development_dependency("rexml", ["~> 3.2"])
Expand Down
18 changes: 4 additions & 14 deletions lib/fluent/plugin_helper/http_server/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,23 +68,17 @@ def start(notify = nil)
notify.push(:ready)
end

if async_v2?
@server_task_queue = ::Thread::Queue.new
@server_task_queue.pop
@server_task&.stop
end
@server_task_queue = ::Thread::Queue.new
@server_task_queue.pop
@server_task&.stop
end

@logger.debug('Finished HTTP server')
end

def stop
@logger.debug('closing HTTP server')
if async_v2?
@server_task_queue&.push(:stop)
else
@server_task&.stop
end
@server_task_queue.push(:stop)
end

HttpServer::Methods::ALL.map { |e| e.downcase.to_sym }.each do |name|
Expand All @@ -100,10 +94,6 @@ def stop
@router.mount(name, path, app || block)
end
end

private def async_v2?
Gem::Version.new(Async::VERSION) >= Gem::Version.new('2.0')
end
end
end
end
Expand Down

0 comments on commit ba5b206

Please sign in to comment.