[Groonga-commit] droonga/droonga-engine at 321e13f [master] Give hostname instead of node name to the absorber correctly

Back to archive index

Kouhei Sutou kou****@clear*****
Tue Mar 24 18:14:59 JST 2015


> +        def source_host
> +          @source_host ||= (source =~ NODE_PATTERN && $1)
> +        end

(source =~ NODE_PATTERN && $1)は別メソッドにして欲しいで
す。。。

def parsed_source
  @parsed_source ||= parse_source(source)
end

def source_host
  @parsed_source.host
end

とかでもいいです。

もし、速度が大事じゃないところ(数回しか呼ばれないところとか)
ならキャッシュしなくてもいいです。

In <321e13f01d40a4d6cfb1ffecee1de4ec716b9d61 �� jenkins.clear-code.com>
  "[Groonga-commit] droonga/droonga-engine �� 321e13f [master] Give hostname instead of node name to the absorber correctly" on Tue, 24 Mar 2015 18:06:58 +0900,
  YUKI Hiroshi <null+groonga �� clear-code.com> wrote:

> YUKI Hiroshi	2015-03-24 18:06:58 +0900 (Tue, 24 Mar 2015)
> 
>   New Revision: 321e13f01d40a4d6cfb1ffecee1de4ec716b9d61
>   https://github.com/droonga/droonga-engine/commit/321e13f01d40a4d6cfb1ffecee1de4ec716b9d61
> 
>   Message:
>     Give hostname instead of node name to the absorber correctly
> 
>   Modified files:
>     lib/droonga/command/remote.rb
> 
>   Modified: lib/droonga/command/remote.rb (+5 -1)
> ===================================================================
> --- lib/droonga/command/remote.rb    2015-03-24 16:54:27 +0900 (22a7886)
> +++ lib/droonga/command/remote.rb    2015-03-24 18:06:58 +0900 (9a10466)
> @@ -278,7 +278,7 @@ module Droonga
>            metadata.set(:absorbing, true)
>  
>            DataAbsorber.absorb(:dataset          => dataset_name,
> -                              :source_host      => source,
> +                              :source_host      => source_host,
>                                :destination_host => host,
>                                :port             => port,
>                                :tag              => tag,
> @@ -293,6 +293,10 @@ module Droonga
>            @params["source"]
>          end
>  
> +        def source_host
> +          @source_host ||= (source =~ NODE_PATTERN && $1)
> +        end
> +
>          def dataset_name
>            @dataset_name ||= @params["dataset"]
>          end




More information about the Groonga-commit mailing list
Back to archive index