Class: Droonga::Plugins::Dump::Dumper
- Inherits:
-
Object
- Object
- Droonga::Plugins::Dump::Dumper
- Includes:
- Loggable
- Defined in:
- lib/droonga/plugins/dump.rb
Instance Method Summary collapse
-
#initialize(context, loop, messenger, request) ⇒ Dumper
constructor
A new instance of Dumper.
- #start_dump ⇒ Object
Constructor Details
#initialize(context, loop, messenger, request) ⇒ Dumper
Returns a new instance of Dumper.
85 86 87 88 89 90 |
# File 'lib/droonga/plugins/dump.rb', line 85 def initialize(context, loop, messenger, request) @context = context @loop = loop @messenger = messenger @request = request end |
Instance Method Details
#start_dump ⇒ Object
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/droonga/plugins/dump.rb', line 92 def start_dump setup_forward_data forward("dump.start") dumper = Fiber.new do dump_schema dump_records dump_indexes forward("dump.end") end on_error = lambda do |exception| = "failed to dump" logger.exception(, $!) error("DumpFailure", ) end timer = Coolio::TimerWatcher.new(0.1, true) timer.on_timer do begin dumper.resume rescue FiberError timer.detach rescue timer.detach on_error.call($!) end end @loop.attach(timer) end |