buildbox 0.3.8 → 0.3.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d03a215ef6a0f1cae6051fcf56554d62abc5815c
4
- data.tar.gz: bcf6037404617835675177820af6a85f60e6bead
3
+ metadata.gz: 2342efcf6dbbfc591fbabea8d86e81f261fb06b6
4
+ data.tar.gz: 316d7a8726e2376bbeb0a54eb615d66c5bc18294
5
5
  SHA512:
6
- metadata.gz: 712c31afdb5346f2cf2f703f8f2dd4f7a9e1237b30a5605a9a6cc8da2633e75d9c2e73d488a8129439cba0ff8fa4433e92e9f9dfc10d48894198899df149cd7a
7
- data.tar.gz: 8980a9e144f21e8dea04ac40a01850f8110343610d74959baf3f852a260570a08e44533a18981aafa9cd9528b529c2e7e664d1759e48c1c16d4cc96c7e6dffb7
6
+ metadata.gz: 3c6ccad33be924b0c2893cff55fa5f33e7ce3d766a15baac6ec57f27cd81f6dc58d1e90e3b8f76a5b6cd1640a426b8abd2ec900cfa773fd2fe087c1108793fba
7
+ data.tar.gz: 4f9022099235838076447e9f19aa6e2c3ea448905444e7ce272e48ff4204f149fd98edde99addcce6b0c65abd828f530c0f6aeb2b31827af469400f8de40f4f9
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- buildbox (0.3.8)
4
+ buildbox (0.3.9)
5
5
  celluloid (~> 0.14)
6
6
  childprocess (~> 0.3)
7
7
  faraday (~> 0.8)
@@ -8,18 +8,24 @@ module Buildbox
8
8
  def initialize(access_token, api = Buildbox::API.new)
9
9
  @api = api
10
10
  @access_token = access_token
11
+ @queue = []
11
12
  end
12
13
 
13
- def work
14
- builds = scheduled_builds
14
+ def process
15
+ unless @processing
16
+ @processing = true
15
17
 
16
- # Run the builds one at a time
17
- builds.each do |build|
18
- # Let the agent know that we're about to start working on this build
19
- @api.update_build(build, :agent_accepted => @access_token)
18
+ scheduled_builds.each { |build| @queue << build }
20
19
 
21
- Monitor.new(build, @api).async.monitor
22
- Runner.new(build).start
20
+ while build = @queue.pop do
21
+ # Let the agent know that we're about to start running this build
22
+ @api.update_build(build, :agent_accepted => @access_token)
23
+
24
+ Monitor.new(build, @api).async.monitor
25
+ Runner.new(build).start
26
+ end
27
+
28
+ @processing = false
23
29
  end
24
30
  end
25
31
 
@@ -29,7 +35,7 @@ module Buildbox
29
35
  agent = @api.agent(@access_token, hostname)
30
36
  @api.scheduled_builds agent
31
37
  rescue Buildbox::API::AgentNotFoundError
32
- warn "Agent `#{@access_token}` doesn't exist"
38
+ warn "Agent `#{@access_token}` does not exist"
33
39
  [] # return empty array to avoid breakage
34
40
  end
35
41
 
@@ -5,8 +5,8 @@ module Buildbox
5
5
  INTERVAL = 5
6
6
 
7
7
  def initialize(config = Buildbox.config, logger = Buildbox.logger)
8
- @config = config
9
- @logger = logger
8
+ @config = config
9
+ @logger = logger
10
10
  @supervisors = []
11
11
  end
12
12
 
@@ -21,7 +21,7 @@ module Buildbox
21
21
 
22
22
  loop do
23
23
  @supervisors.each do |supervisor|
24
- supervisor.actors.first.async.work
24
+ supervisor.actors.first.async.process
25
25
  end
26
26
 
27
27
  wait INTERVAL
@@ -1,3 +1,3 @@
1
1
  module Buildbox
2
- VERSION = "0.3.8"
2
+ VERSION = "0.3.9"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: buildbox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.8
4
+ version: 0.3.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Keith Pitt