Class: GroongaQueryLog::MemoryLeakDetector

Inherits:
Object
  • Object
show all
Defined in:
lib/groonga-query-log/memory-leak-detector.rb

Defined Under Namespace

Classes: Options

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ MemoryLeakDetector

Returns a new instance of MemoryLeakDetector.



25
26
27
# File 'lib/groonga-query-log/memory-leak-detector.rb', line 25

def initialize(options)
  @options = options
end

Instance Method Details

#detect(input) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/groonga-query-log/memory-leak-detector.rb', line 29

def detect(input)
  each_command(input) do |command|
    @options.create_client do |client|
      begin
        check_command(client, command)
      rescue Groonga::Client::Connection::Error
        # TODO: add error log mechanism
        $stderr.puts(Time.now.iso8601(6))
        $stderr.puts(command.original_source)
        $stderr.puts($!.raw_error.message)
        $stderr.puts($!.raw_error.backtrace)
      end
    end
  end
end