Sha256: 231f2d643d09e7a8bfc8fb88490cb8f803b07f76c6babb13dad76855c82f58b1

Contents?: true

Size: 1.11 KB

Versions: 8

Compression:

Stored size: 1.11 KB

Contents

# FIXME: BypassProcessSenderみたいにする
class ProconBypassMan::RemoteActionReceiver
  # forkしたプロセスで動かすクラス。sock経由で命令を受け取ってmacoのキューに積んでいく
  def self.start_with_foreground!
    return unless ProconBypassMan.config.enable_remote_action?

    run
  end

  def self.start!
    return unless ProconBypassMan.config.enable_remote_action?

    Thread.start do
      start_with_foreground!
    end
  end

  def self.run
    while(task = ProconBypassMan::RemoteAction::QueueOverProcess.pop)
      receive(task)
    end
    shutdown
  rescue Errno::ENOENT, Errno::ECONNRESET, Errno::ECONNREFUSED => e
    ProconBypassMan.logger.debug(e)
  end


  # @param [ProconBypassMan::RemoteAction::Task] task
  def self.receive(task)
    ProconBypassMan.logger.info "[remote macro][receiver] name: #{task.name}, uuid: #{task.uuid}, steps: #{task.steps}, type: #{task.type}"
    ProconBypassMan::RemoteAction::TaskQueueInProcess.push(task)
    true
  end

  def self.shutdown
    ProconBypassMan.logger.info("ProconBypassMan::RemoteMacroReceiverを終了します。")
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
procon_bypass_man-0.3.12 lib/procon_bypass_man/remote_action/remote_action_receiver.rb
procon_bypass_man-0.3.11 lib/procon_bypass_man/remote_action/remote_action_receiver.rb
procon_bypass_man-0.3.10 lib/procon_bypass_man/remote_action/remote_action_receiver.rb
procon_bypass_man-0.3.9 lib/procon_bypass_man/remote_action/remote_action_receiver.rb
procon_bypass_man-0.3.8.1 lib/procon_bypass_man/remote_action/remote_action_receiver.rb
procon_bypass_man-0.3.8 lib/procon_bypass_man/remote_action/remote_action_receiver.rb
procon_bypass_man-0.3.7 lib/procon_bypass_man/remote_action/remote_action_receiver.rb
procon_bypass_man-0.3.6 lib/procon_bypass_man/remote_action/remote_action_receiver.rb