Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating timer of purging obsolete sockets if keepalive_timeout is nil #2943

Merged
merged 1 commit into from Apr 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/fluent/plugin/out_forward.rb
Expand Up @@ -324,7 +324,7 @@ def start
end
end

if @keepalive && @keepalive_timeout
if @keepalive
timer_execute(:out_forward_keep_alived_socket_watcher, @keep_alive_watcher_interval, &method(:on_purge_obsolete_socks))
end
end
Expand Down
9 changes: 9 additions & 0 deletions test/plugin/test_out_forward.rb
Expand Up @@ -1200,6 +1200,15 @@ def plugin_id_for_test?
end
end

test 'create timer of purging obsolete sockets' do
output_conf = CONFIG + %[keepalive true]
d = create_driver(output_conf)

mock(d.instance).timer_execute(:out_forward_heartbeat_request, 1).once
mock(d.instance).timer_execute(:out_forward_keep_alived_socket_watcher, 5).once
d.instance_start
end

sub_test_case 'with require_ack_response' do
test 'Create connection per send_data' do
target_input_driver = create_target_input_driver(conf: TARGET_CONFIG)
Expand Down