pwwka 0.13.0.RC1 → 0.13.0.RC2

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: c804b87530f9d0b29e22b2a10131c8e7ef122cf2
4
- data.tar.gz: 0a7b10536a20463505d055ac9797664320a58dbf
3
+ metadata.gz: dd8463f1ae68bd33512f90d6dc9925bd78475d4c
4
+ data.tar.gz: f1b8197403748e2c5e56fcc206246508d03b5ab4
5
5
  SHA512:
6
- metadata.gz: 3c68568f681edce5f795676d3ed340f1d2ae5f52f333c1546c967cc3fa788f71b568b7abfe94b670013c825f0a8cbe8b6399574e9ebc7eddaada252c98f045fc
7
- data.tar.gz: 0b61ce8f1fa5c070d11f09b41cf494aaa4e3e32a1793395f498237dfea94feedc267f449ce4b6a31d97bc0fd34592e029cd4b89c4e24849f534fbd28542998b3
6
+ metadata.gz: 5a65a393afb21da57d4e7039a383cae9db6631d1e06eca582d522b854b18a689fc2a605bd9b444331619c05d9b6a05653e36fe3bbb71a406b6b9f210b34e165c
7
+ data.tar.gz: e1bc690879b66874219c42a98129588d33ab6f8cb1df4e30bc6a04b23238df8f493c4fb796baf03d718617141233692034de6cd5563986073400ab53cf3dd77b
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pwwka (0.13.0.RC1)
4
+ pwwka (0.13.0.RC2)
5
5
  activemodel
6
6
  activesupport
7
7
  bunny
@@ -15,15 +15,6 @@ module Pwwka
15
15
  attr_writer :app_id
16
16
  attr_writer :error_handling_chain
17
17
 
18
- def keep_alive_on_handler_klass_exceptions=(val)
19
- @keep_alive_on_handler_klass_exceptions = val
20
- @error_handling_chain = nil
21
- end
22
- def requeue_on_error=(val)
23
- @requeue_on_error = val
24
- @error_handling_chain = nil
25
- end
26
-
27
18
  def initialize
28
19
  @rabbit_mq_host = nil
29
20
  @topic_exchange_name = "pwwka.topics.#{Pwwka.environment}"
@@ -85,5 +76,28 @@ module Pwwka
85
76
  end
86
77
  end
87
78
 
79
+ def keep_alive_on_handler_klass_exceptions=(val)
80
+ @keep_alive_on_handler_klass_exceptions = val
81
+ if @keep_alive_on_handler_klass_exceptions
82
+ @error_handling_chain.delete(Pwwka::ErrorHandlers::Crash)
83
+ elsif !@error_handling_chain.include?(Pwwka::ErrorHandlers::Crash)
84
+ @error_handling_chain << Pwwka::ErrorHandlers::Crash
85
+ end
86
+ end
87
+
88
+ def requeue_on_error=(val)
89
+ @requeue_on_error = val
90
+ if @requeue_on_error
91
+ index = error_handling_chain.index(Pwwka::ErrorHandlers::NackAndIgnore)
92
+ if index
93
+ @error_handling_chain[index] = Pwwka::ErrorHandlers::NackAndRequeueOnce
94
+ end
95
+ else
96
+ index = error_handling_chain.index(Pwwka::ErrorHandlers::NackAndRequeueOnce)
97
+ if index
98
+ @error_handling_chain[index] = Pwwka::ErrorHandlers::NackAndIgnore
99
+ end
100
+ end
101
+ end
88
102
  end
89
103
  end
data/lib/pwwka/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Pwwka
2
- VERSION = '0.13.0.RC1'
2
+ VERSION = '0.13.0.RC2'
3
3
  end
@@ -8,6 +8,7 @@ describe "receivers with unhandled errors", :integration do
8
8
 
9
9
  before do
10
10
  @testing_setup = IntegrationTestSetup.new
11
+ Pwwka.configuration.instance_variable_set("@error_handling_chain",nil)
11
12
  Pwwka.configure do |c|
12
13
  c.requeue_on_error = false
13
14
  c.keep_alive_on_handler_klass_exceptions = false
@@ -79,4 +79,44 @@ describe Pwwka::Configuration do
79
79
  end
80
80
  end
81
81
  end
82
+
83
+ describe "#error_handling_chain" do
84
+ before do
85
+ configuration.instance_variable_set("@error_handling_chain",nil)
86
+ end
87
+ context "implicit configuration" do
88
+ context "when requeue_on_error" do
89
+ context "when keep_alive_on_handler_klass_exceptions" do
90
+ it "is NackAndRequeueOnce" do
91
+ configuration.requeue_on_error = true
92
+ configuration.keep_alive_on_handler_klass_exceptions = true
93
+ expect(configuration.error_handling_chain).to eq([Pwwka::ErrorHandlers::NackAndRequeueOnce])
94
+ end
95
+ end
96
+ context "when not keep_alive_on_handler_klass_exceptions" do
97
+ it "is NackAndRequeueOnce,Crash" do
98
+ configuration.requeue_on_error = true
99
+ configuration.keep_alive_on_handler_klass_exceptions = false
100
+ expect(configuration.error_handling_chain).to eq([Pwwka::ErrorHandlers::NackAndRequeueOnce,Pwwka::ErrorHandlers::Crash])
101
+ end
102
+ end
103
+ end
104
+ context "when not requeue_on_error" do
105
+ context "when keep_alive_on_handler_klass_exceptions" do
106
+ it "is NackAndIgnore" do
107
+ configuration.requeue_on_error = false
108
+ configuration.keep_alive_on_handler_klass_exceptions = true
109
+ expect(configuration.error_handling_chain).to eq([Pwwka::ErrorHandlers::NackAndIgnore])
110
+ end
111
+ end
112
+ context "when not keep_alive_on_handler_klass_exceptions" do
113
+ it "is NackAndIgnore,Crash" do
114
+ configuration.requeue_on_error = false
115
+ configuration.keep_alive_on_handler_klass_exceptions = false
116
+ expect(configuration.error_handling_chain).to eq([Pwwka::ErrorHandlers::NackAndIgnore,Pwwka::ErrorHandlers::Crash])
117
+ end
118
+ end
119
+ end
120
+ end
121
+ end
82
122
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pwwka
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.0.RC1
4
+ version: 0.13.0.RC2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stitch Fix Engineering