Navigation Menu

Skip to content

Commit

Permalink
droonga-engine: add shortcut to signals
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Apr 22, 2014
1 parent a6edac7 commit 6fc40f5
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions lib/droonga/engine/command/droonga_engine.rb
Expand Up @@ -26,6 +26,10 @@ module Droonga
class Engine
module Command
module DroongaEngine
module Signals
include ServerEngine::Daemon::Signals
end

class Configuration
DEFAULT_HOST = Socket.gethostname
DEFAULT_PORT = 10031
Expand Down Expand Up @@ -156,14 +160,12 @@ def run_main_loop
Process.kill(:INT, service_pid)
running = false
end
trap(ServerEngine::Daemon::Signals::GRACEFUL_STOP) do
Process.kill(ServerEngine::Daemon::Signals::GRACEFUL_STOP,
service_pid)
trap(Signals::GRACEFUL_STOP) do
Process.kill(Signals::GRACEFUL_STOP, service_pid)
running = false
end
trap(ServerEngine::Daemon::Signals::IMMEDIATE_STOP) do
Process.kill(ServerEngine::Daemon::Signals::IMMEDIATE_STOP,
service_pid)
trap(Signals::IMMEDIATE_STOP) do
Process.kill(Signals::IMMEDIATE_STOP, service_pid)
running = false
end

Expand Down Expand Up @@ -307,10 +309,10 @@ def on_message(tag, time, record)
end

def setup_signals
trap(ServerEngine::Daemon::Signals::GRACEFUL_STOP) do
trap(Signals::GRACEFUL_STOP) do
stop_graceful
end
trap(ServerEngine::Daemon::Signals::IMMEDIATE_STOP) do
trap(Signals::IMMEDIATE_STOP) do
stop_immediate
end
trap(:INT) do
Expand Down

0 comments on commit 6fc40f5

Please sign in to comment.