diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/aclog/receiver/collector_connection.rb | 6 | ||||
-rw-r--r-- | lib/aclog/receiver/register_server.rb | 15 |
2 files changed, 11 insertions, 10 deletions
diff --git a/lib/aclog/receiver/collector_connection.rb b/lib/aclog/receiver/collector_connection.rb index 3d441b1..8b566cc 100644 --- a/lib/aclog/receiver/collector_connection.rb +++ b/lib/aclog/receiver/collector_connection.rb @@ -28,6 +28,12 @@ module Aclog Rails.logger.debug("Sent #{account.id}/#{account.user_id}") end + def send_stop_account(account) + send_object(type: "stop", + id: account.id) + Rails.logger.debug("Sent Stop #{account.id}/#{account.user_id}") + end + def post_init # なにもしない。クライアントが end diff --git a/lib/aclog/receiver/register_server.rb b/lib/aclog/receiver/register_server.rb index 4f8a06c..541efd5 100644 --- a/lib/aclog/receiver/register_server.rb +++ b/lib/aclog/receiver/register_server.rb @@ -11,20 +11,15 @@ module Aclog con_num = account.id % Settings.collector.count con = @connections[con_num] if con - con.send_account(account) - Rails.logger.info("Sent account: connection_number: #{con_num} / account_id: #{account.id}") + if account.active? + con.send_account(account) + else + con.send_stop_account(account) + end else Rails.logger.info("Connection not found: connection_number: #{con_num} / account_id: #{account.id}") end end - - def unregister(account_) - account = Marshal.load(account_) - end - - def unregister(account) - # TODO - end end end end |