pheme 3.3.0 → 3.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pheme/queue_poller.rb +15 -17
- data/lib/pheme/version.rb +1 -1
- data/spec/configuration_spec.rb +1 -1
- data/spec/message_type/sns_message_spec.rb +6 -6
- data/spec/queue_poller_spec.rb +4 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62d4b2ba0e79681e04b9069a54b4132facee47ce50e5fa3f9fa0f4ac6f3b5dd0
|
4
|
+
data.tar.gz: 56159e0007559116b2ca486e1f73f3a209b79aa7d4ce3a746ff953e100853be0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 046d1c5e5119bc35bc47d721a728e45840275790891bd5f4aa474f335b1d9fb456462c07a1b349ec71cc4f6c55a61fb65ae21bf5d2fd8bf7f51aadb842ee97c7
|
7
|
+
data.tar.gz: b6e6dcb3d819c50999cbfc89d941c5046f7dfabcb63004f780bdc2d53c198246483eaf2985340b3a7514eb3fa6d21f81950e5febfcff923350fe15527668d09c
|
data/lib/pheme/queue_poller.rb
CHANGED
@@ -53,23 +53,21 @@ module Pheme
|
|
53
53
|
|
54
54
|
def poll
|
55
55
|
time_start = log_polling_start
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
Pheme.rollbar(e, "#{self.class} failed to process message", { message: content })
|
72
|
-
end
|
56
|
+
queue_poller.poll(poller_configuration) do |queue_message|
|
57
|
+
@messages_received += 1
|
58
|
+
Pheme.logger.tagged(queue_message.message_id) do
|
59
|
+
begin
|
60
|
+
content = parse_body(queue_message)
|
61
|
+
metadata = parse_metadata(queue_message)
|
62
|
+
with_optional_connection_pool_block { handle(content, metadata) }
|
63
|
+
queue_poller.delete_message(queue_message)
|
64
|
+
log_delete(queue_message)
|
65
|
+
@messages_processed += 1
|
66
|
+
rescue SignalException
|
67
|
+
throw :stop_polling
|
68
|
+
rescue StandardError => e
|
69
|
+
Pheme.logger.error(e)
|
70
|
+
Pheme.rollbar(e, "#{self.class} failed to process message", { message: content })
|
73
71
|
end
|
74
72
|
end
|
75
73
|
end
|
data/lib/pheme/version.rb
CHANGED
data/spec/configuration_spec.rb
CHANGED
@@ -1,10 +1,4 @@
|
|
1
1
|
describe Pheme::MessageType::SnsMessage do
|
2
|
-
module SnsMessage
|
3
|
-
class Fixture < ExampleQueuePoller
|
4
|
-
include Pheme::MessageType::SnsMessage
|
5
|
-
end
|
6
|
-
end
|
7
|
-
|
8
2
|
subject { SnsMessage::Fixture.new }
|
9
3
|
|
10
4
|
let(:poller) do
|
@@ -16,6 +10,12 @@ describe Pheme::MessageType::SnsMessage do
|
|
16
10
|
end
|
17
11
|
|
18
12
|
before do
|
13
|
+
test_class = Class.new(ExampleQueuePoller) do
|
14
|
+
include Pheme::MessageType::SnsMessage
|
15
|
+
end
|
16
|
+
|
17
|
+
stub_const('SnsMessage::Fixture', test_class)
|
18
|
+
|
19
19
|
use_default_configuration!
|
20
20
|
allow(Aws::SQS::QueuePoller).to receive(:new) { poller }
|
21
21
|
end
|
data/spec/queue_poller_spec.rb
CHANGED
@@ -201,11 +201,11 @@ describe Pheme::QueuePoller do
|
|
201
201
|
|
202
202
|
describe "#poll" do
|
203
203
|
before do
|
204
|
-
|
205
|
-
|
206
|
-
def self.connection_pool; end
|
207
|
-
end
|
204
|
+
active_record_stub = Class.new do
|
205
|
+
def connection_pool; end
|
208
206
|
end
|
207
|
+
|
208
|
+
stub_const('ActiveRecord::Base', active_record_stub)
|
209
209
|
end
|
210
210
|
|
211
211
|
context "with connection pool block" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pheme
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.3.
|
4
|
+
version: 3.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Graham
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-09-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|