Class: Grntest::Executors::HTTPExecutor

Inherits:
BaseExecutor show all
Defined in:
lib/grntest/executors/http-executor.rb

Instance Attribute Summary

Attributes inherited from BaseExecutor

#context

Instance Method Summary collapse

Methods inherited from BaseExecutor

#execute, #shutdown

Constructor Details

#initialize(host, port, context) ⇒ HTTPExecutor

Returns a new instance of HTTPExecutor.



25
26
27
28
29
# File 'lib/grntest/executors/http-executor.rb', line 25

def initialize(host, port, context)
  super(context)
  @host = host
  @port = port
end

Instance Method Details

#create_sub_executor(context) ⇒ Object



51
52
53
# File 'lib/grntest/executors/http-executor.rb', line 51

def create_sub_executor(context)
  self.class.new(@host, @port, context)
end

#ensure_groonga_readyObject



39
40
41
42
43
44
45
46
47
48
49
# File 'lib/grntest/executors/http-executor.rb', line 39

def ensure_groonga_ready
  n_retried = 0
  begin
    send_command(command("status"))
  rescue Error
    n_retried += 1
    sleep(0.1)
    retry if n_retried < 100
    raise
  end
end

#send_command(command) ⇒ Object



31
32
33
34
35
36
37
# File 'lib/grntest/executors/http-executor.rb', line 31

def send_command(command)
  if command.name == "load"
    send_load_command(command)
  else
    send_normal_command(command)
  end
end