dynamo-autoscale 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,9 @@
1
+ v0.1.4
2
+
3
+ - Fixed a bug that stopped all rule evaluation after the first rule passed. Now
4
+ all read rules and write rules are executed separately and only short circuit
5
+ per metric.
6
+
1
7
  v0.1.3
2
8
 
3
9
  - Minor logging tweaks.
@@ -174,6 +174,14 @@ module DynamoAutoscale
174
174
  message
175
175
  end
176
176
 
177
+ def reads?
178
+ @metric == :consumed_reads
179
+ end
180
+
181
+ def writes?
182
+ @metric == :consumed_writes
183
+ end
184
+
177
185
  def serialize
178
186
  metric = @metric == :consumed_reads ? "reads" : "writes"
179
187
 
@@ -19,9 +19,18 @@ module DynamoAutoscale
19
19
  end
20
20
 
21
21
  def test table
22
- self.for(table.name).each do |rule|
23
- return true if rule.test(table)
22
+ result = false
23
+ rules = self.for(table.name)
24
+
25
+ rules.select(&:reads?).each do |rule|
26
+ break result = true if rule.test(table)
27
+ end
28
+
29
+ rules.select(&:writes?).each do |rule|
30
+ break result = true if rule.test(table)
24
31
  end
32
+
33
+ result
25
34
  end
26
35
 
27
36
  def table table_name, &block
@@ -1,3 +1,3 @@
1
1
  module DynamoAutoscale
2
- VERSION = '0.1.3'
2
+ VERSION = '0.1.4'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dynamo-autoscale
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: