Skip to content

Commit

Permalink
Fix value of system_config.workers at run_configure
Browse files Browse the repository at this point in the history
Override `system_config` only if `conf.target_worker_ids.size >= 1`.

* If `<worker N>` or `<worker 0-N>` is not set, `conf.target_worker_ids` is empty.
* If `<system> workers N </system>` is not set, `system_config.workers` defaults to 1.

Signed-off-by: abetomo <[email protected]>
  • Loading branch information
abetomo committed Feb 20, 2023
1 parent 6c649d1 commit 355ca5f
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions lib/fluent/plugin/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,9 @@ def fluentd_worker_id

def configure(conf)
if Fluent::Engine.supervisor_mode || (conf.respond_to?(:for_this_worker?) && conf.for_this_worker?)
workers = if conf.target_worker_ids && !conf.target_worker_ids.empty?
conf.target_worker_ids.size
else
1
end
system_config_override(workers: workers)
if !conf&.target_worker_ids&.empty?
system_config_override(workers: conf.target_worker_ids.size)
end
end
super(conf, system_config.strict_config_value)
@_state ||= State.new(false, false, false, false, false, false, false, false, false)
Expand Down

0 comments on commit 355ca5f

Please sign in to comment.