Sha256: 23f1ae8becdf4b33a82278efa9c247dd3fb8e5d61c8feca3e3eb93281c5e9c87

Contents?: true

Size: 612 Bytes

Versions: 6

Compression:

Stored size: 612 Bytes

Contents

module Buildbox
  class Server
    INTERVAL = 5

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

    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

    private

    def api
      @api ||= Buildbox::API.new
    end

    def agent_access_tokens
      @config.agent_access_tokens
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
buildbox-0.3.3 lib/buildbox/server.rb
buildbox-0.3.2 lib/buildbox/server.rb
buildbox-0.3.1 lib/buildbox/server.rb
buildbox-0.3 lib/buildbox/server.rb
buildbox-0.2.3 lib/buildbox/server.rb
buildbox-0.2.2 lib/buildbox/server.rb