From 27de4844fe94d25963e9b81795d2acf894ae8b0c Mon Sep 17 00:00:00 2001 From: Yuta Iwama Date: Wed, 30 Oct 2019 16:46:47 +0900 Subject: [PATCH] Delete unnecessary methods and write them directry these methods have only one line. so they're duplicated Signed-off-by: Yuta Iwama --- lib/fluent/supervisor.rb | 30 +++++++----------------------- 1 file changed, 7 insertions(+), 23 deletions(-) diff --git a/lib/fluent/supervisor.rb b/lib/fluent/supervisor.rb index ce531a65a5..1a0832f085 100644 --- a/lib/fluent/supervisor.rb +++ b/lib/fluent/supervisor.rb @@ -526,11 +526,11 @@ def run_worker main_process do create_socket_manager if @standalone_worker - change_privilege if @standalone_worker + ServerEngine::Privilege.change(@chuser, @chgroup) if @standalone_worker MessagePackFactory.init - init_engine - run_configure - run_engine + Fluent::Engine.init(@system_config) + Fluent::Engine.run_configure(@conf) + Fluent::Engine.run self.class.cleanup_resources if @standalone_worker exit 0 end @@ -602,10 +602,10 @@ def dry_run_cmd def dry_run begin Fluent::Engine.dry_run_mode = true - change_privilege + ServerEngine::Privilege.change(@chuser, @chgroup) MessagePackFactory.init - init_engine - run_configure + Fluent::Engine.init(@system_config) + Fluent::Engine.run_configure(@conf) rescue Fluent::ConfigError => e $log.error "config error", file: @config_path, error: e $log.debug_backtrace @@ -819,21 +819,5 @@ def build_system_config(conf) system_config.overwrite_variables(opt) system_config end - - def change_privilege - ServerEngine::Privilege.change(@chuser, @chgroup) - end - - def init_engine - Fluent::Engine.init(@system_config) - end - - def run_configure - Fluent::Engine.run_configure(@conf) - end - - def run_engine - Fluent::Engine.run - end end end