Skip to content

Commit

Permalink
in_tail_with_throttle: Remove nested method and modify indentation
Browse files Browse the repository at this point in the history
Signed-off-by: Pranjal Gupta <[email protected]>
  • Loading branch information
Pranjal-Gupta2 committed Oct 22, 2021
1 parent 0e5e037 commit cacc2c7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
22 changes: 11 additions & 11 deletions lib/fluent/plugin/in_tail_with_throttle.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,17 +83,17 @@ def construct_groupwatchers
end
end

def find_group_from_metadata(path)
def find_group(namespace, appname)
namespace_key = @group_watchers.keys.find { |regexp| namespace.match?(regexp) && regexp != DEFAULT_NAMESPACE }
namespace_key ||= DEFAULT_NAMESPACE
def find_group(namespace, appname)
namespace_key = @group_watchers.keys.find { |regexp| namespace.match?(regexp) && regexp != DEFAULT_NAMESPACE }
namespace_key ||= DEFAULT_NAMESPACE

appname_key = @group_watchers[namespace_key].keys.find { |regexp| appname.match?(regexp) && regexp != DEFAULT_APPNAME }
appname_key ||= DEFAULT_APPNAME
appname_key = @group_watchers[namespace_key].keys.find { |regexp| appname.match?(regexp) && regexp != DEFAULT_APPNAME }
appname_key ||= DEFAULT_APPNAME

@group_watchers[namespace_key][appname_key]
end

@group_watchers[namespace_key][appname_key]
end

def find_group_from_metadata(path)
begin
metadata = @group.pattern.match(path)
group_watcher = find_group(metadata['namespace'], metadata['appname'])
Expand All @@ -120,8 +120,8 @@ def setup_watcher(target_info, pe)
tw.group_watcher = group_watcher

tw
rescue => e
raise e
rescue => e
raise e
end

def detach_watcher_after_rotate_wait(tw, ino)
Expand Down
2 changes: 1 addition & 1 deletion test/plugin/test_in_tail_with_throttle.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require_relative '../helper'
# require_relative './test_in_tail'

require 'fluent/test'
require 'fluent/test/helpers'
require 'fluent/test/driver/input'
Expand Down

0 comments on commit cacc2c7

Please sign in to comment.