autoscale-agent 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +8 -0
- data/lib/autoscale/agent/util.rb +16 -0
- data/lib/autoscale/agent/version.rb +1 -1
- data/lib/autoscale/agent/worker_dispatchers.rb +1 -13
- data/lib/autoscale/agent.rb +2 -2
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5e5fac211926fd32008d9b5a34821744f5641c8b8cb87d8eac252216120e4ff0
|
4
|
+
data.tar.gz: 4c18afc1684e781380dad1eefa25f1415b315659919138839d3e2b016042e5a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c907c30ca3ad52721dcc9d702c2f2afcea7c14ca3851c60f3983ad7256bca5068d98c24b92416263bbc83ed915a3d9be1377597c4f8d7070c09099c5ee9c9012
|
7
|
+
data.tar.gz: 28c7a7328a84a2e8c30a8b98fb21a873ae5702fd23733c87023a53b4d3ab0b149fa19e56ae89642ac0e194081ff0b52bfed4fce4883c6c065552ce04ba362b9a
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -38,6 +38,14 @@ See Rake for relevant tasks:
|
|
38
38
|
|
39
39
|
bin/rake -T
|
40
40
|
|
41
|
+
## Release
|
42
|
+
|
43
|
+
1. Finalize CHANGELOG.md
|
44
|
+
2. Update version.rb
|
45
|
+
3. Run `bundle install`
|
46
|
+
4. Commit
|
47
|
+
5. Create and push a new tag (`v1.2.3`)
|
48
|
+
|
41
49
|
## Contributing
|
42
50
|
|
43
51
|
Bug reports and pull requests are welcome on GitHub at https://github.com/autoscale-app/ruby-agent
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Autoscale
|
2
|
+
module Agent
|
3
|
+
module Util
|
4
|
+
module_function
|
5
|
+
|
6
|
+
def loop_with_interval(interval, &block)
|
7
|
+
loop do
|
8
|
+
start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
9
|
+
block.call
|
10
|
+
duration = Process.clock_gettime(Process::CLOCK_MONOTONIC) - start
|
11
|
+
sleep [0, interval - duration].max
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -7,8 +7,6 @@ module Autoscale
|
|
7
7
|
|
8
8
|
def initialize
|
9
9
|
@dispatchers = []
|
10
|
-
@running = false
|
11
|
-
@running_lock = Mutex.new
|
12
10
|
end
|
13
11
|
|
14
12
|
def each(&block)
|
@@ -28,17 +26,7 @@ module Autoscale
|
|
28
26
|
end
|
29
27
|
|
30
28
|
def run
|
31
|
-
|
32
|
-
return if @running
|
33
|
-
@running = true
|
34
|
-
end
|
35
|
-
|
36
|
-
Thread.new do
|
37
|
-
loop do
|
38
|
-
dispatch
|
39
|
-
sleep DISPATCH_INTERVAL
|
40
|
-
end
|
41
|
-
end
|
29
|
+
Util.loop_with_interval(DISPATCH_INTERVAL) { dispatch }
|
42
30
|
end
|
43
31
|
end
|
44
32
|
end
|
data/lib/autoscale/agent.rb
CHANGED
@@ -4,7 +4,9 @@ require "multi_json"
|
|
4
4
|
|
5
5
|
require_relative "agent/configuration"
|
6
6
|
require_relative "agent/middleware"
|
7
|
+
require_relative "agent/railtie" if defined?(Rails::Railtie)
|
7
8
|
require_relative "agent/request"
|
9
|
+
require_relative "agent/util"
|
8
10
|
require_relative "agent/version"
|
9
11
|
require_relative "agent/web_dispatcher"
|
10
12
|
require_relative "agent/worker_dispatcher"
|
@@ -25,5 +27,3 @@ module Autoscale
|
|
25
27
|
end
|
26
28
|
end
|
27
29
|
end
|
28
|
-
|
29
|
-
require_relative "agent/railtie" if defined?(Rails::Railtie)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: autoscale-agent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael R. van Rooijen
|
@@ -40,6 +40,7 @@ files:
|
|
40
40
|
- lib/autoscale/agent/middleware.rb
|
41
41
|
- lib/autoscale/agent/railtie.rb
|
42
42
|
- lib/autoscale/agent/request.rb
|
43
|
+
- lib/autoscale/agent/util.rb
|
43
44
|
- lib/autoscale/agent/version.rb
|
44
45
|
- lib/autoscale/agent/web_dispatcher.rb
|
45
46
|
- lib/autoscale/agent/worker_dispatcher.rb
|