Class: Buildbox::Server

Inherits:
Object
  • Object
show all
Defined in:
lib/buildbox/server.rb

Constant Summary collapse

INTERVAL =
5

Instance Method Summary collapse

Constructor Details

#initialize(config = Buildbox.config, logger = Buildbox.logger) ⇒ Server

Returns a new instance of Server.



5
6
7
8
# File 'lib/buildbox/server.rb', line 5

def initialize(config = Buildbox.config, logger = Buildbox.logger)
  @config = config
  @logger = logger
end

Instance Method Details

#startObject



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/buildbox/server.rb', line 10

def start
  loop do
    @config.check
    @config.reload

    agent_access_tokens.each do |access_token|
      Buildbox::Agent.new(access_token, api).work
    end

    @logger.info "Sleeping for #{INTERVAL} seconds"
    sleep INTERVAL
  end
end