Class: Pixo::Rpc::AddFadecandy

Inherits:
Object
  • Object
show all
Defined in:
lib/pixo/rpc/request_types.rb

Instance Method Summary collapse

Constructor Details

#initialize(hostname, count) ⇒ AddFadecandy

Returns a new instance of AddFadecandy.



39
40
41
42
# File 'lib/pixo/rpc/request_types.rb', line 39

def initialize(hostname, count)
  @hostname = hostname
  @count = count
end

Instance Method Details

#call(service) ⇒ Object



44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/pixo/rpc/request_types.rb', line 44

def call(service)
  result = nil
  latch = Concurrent::CountDownLatch.new(1)

  service.application.post( Proc.new do |app|
          app.add_fadecandy(@hostname, @count)
          result = @hostname
          latch.count_down
        end)
  latch.wait

  result
end