class Mist::Client

Public Class Methods

new(pool) click to toggle source
# File lib/mist/client.rb, line 19
def initialize(pool)
  @pool = pool
end

Public Instance Methods

call(method, args = {}) click to toggle source
# File lib/mist/client.rb, line 23
def call(method, args = {})
  server = args[:server] || @pool.acquire
  timeout = args[:timeout] || 300
  Mist.logger.debug "got server #{server}"

  server_info = server.split(':')
  host = server_info[0]
  port = server_info[1] || '18800'

  client = MessagePack::RPC::Client.new(host, port)
  client.timeout = timeout
  result = client.call(method, args)

  @pool.release server

  return result
end