propono 0.8.0 → 0.8.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- ZDQ0NzcyNzRmNTc5YjM2N2RjYTRiY2FjMDZmOGFiMTZiZTg1NmZiNQ==
5
- data.tar.gz: !binary |-
6
- MGY0OTNiNDExMjk4M2U2OTk2NjNkNzNmNWViYzlhMGU5MTM0NjJjNA==
2
+ SHA1:
3
+ metadata.gz: a38b1949af11e63f303a09478759c077f484d95d
4
+ data.tar.gz: 7d937ce9d0e24a3e764705ed5d9f21203d094d28
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- ODJiYTFjMGYyMjNlMjhkNzU0NGQ3ZTVkYTc2MGU0ZjQ0Y2IxMTU3OTRmMDZh
10
- ZDc1MDg1NWZhYjM5YzE4MzUyMDgwOWRlM2ExOTVhNzBlMGE3MTk3MGNlYWFh
11
- ZGYwNWI1ZTg0OWVkNGE2YjZmM2M3ZTI1YjhiNTczMTYzNGNhMjQ=
12
- data.tar.gz: !binary |-
13
- YWI4ZDIxYzRjNGVkYzk3ZjdlZDBlNDZhOGMyMjg2MWY2ZTU1MDczOGM5NWRl
14
- NWIyZTZkOGNmYmI4MDFiODYwZTY5MTZhZDk0NzMwMjc0ZDJiNGZlNzMwOTli
15
- ZDcyMWQyNzhiMTZjMjZhZTJkNzk5NjYzYjA3ZjU2NDE5MGFhMDQ=
6
+ metadata.gz: 21de4b1f7ea789868a848ae044ef43ec01dacf8869a3a89a1a33d9aab04a5ab3d6ce4a17aacf4c701262fa2a6b8bb605327c82d4294bd76ee2c7410165165e32
7
+ data.tar.gz: c39b68a06d648db435b3811cba44a81811702f0aea2a87d8fa4f48d8864a047d400b34540fe7510105d7e7939313698fcd2db42f0ee5b84918f66b2402ee79cf
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ # 0.8.2 / 2013-11-01
2
+
3
+ * [BUGFIX] Replace thread library with standard ruby threads to fix Unicorn problems.
4
+
5
+ # 0.8.1 / 2013-11-01
6
+
7
+ * [FEATURE] Log all messages published from Propono.
8
+
1
9
  # 0.8.0 / 2013-11-01
2
10
 
3
11
  * [FEATURE] SNS publish now delegates to a thread pool. The SNS response can be accessed via a future.
data/lib/propono.rb CHANGED
@@ -2,8 +2,6 @@
2
2
  #
3
3
  # Propono is a pub/sub gem built on top of Amazon Web Services (AWS). It uses Simple Notification Service (SNS) and Simple Queue Service (SQS) to seamlessly pass messages throughout your infrastructure.
4
4
 
5
- require "thread/pool"
6
-
7
5
  require "propono/version"
8
6
  require 'propono/propono_error'
9
7
  require 'propono/logger'
@@ -28,8 +26,6 @@ require "propono/services/tcp_listener"
28
26
  # It uses Simple Notification Service (SNS) and Simple Queue Service (SQS)
29
27
  # to seamlessly pass messages throughout your infrastructure.
30
28
  module Propono
31
-
32
- WORKER_POOL = Thread.pool(4)
33
29
 
34
30
  # Propono configuration settings.
35
31
  #
@@ -1,5 +1,4 @@
1
1
  require 'socket'
2
- require 'thread/future'
3
2
 
4
3
  module Propono
5
4
  class PublisherError < ProponoError
@@ -24,6 +23,7 @@ module Propono
24
23
  end
25
24
 
26
25
  def publish
26
+ Propono.config.logger.info "Propono: Publishing #{message} to #{topic_id} via #{protocol}"
27
27
  send("publish_via_#{protocol}")
28
28
  end
29
29
 
@@ -32,8 +32,12 @@ module Propono
32
32
  def publish_via_sns
33
33
  topic = TopicCreator.find_or_create(topic_id)
34
34
  msg = message.is_a?(String) ? message : message.to_json
35
- Thread.future(WORKER_POOL) do
36
- sns.publish(topic.arn, msg)
35
+ Thread.new do
36
+ begin
37
+ sns.publish(topic.arn, msg)
38
+ rescue => e
39
+ Propono.config.logger.error "Propono failed to send via sns : #{e}"
40
+ end
37
41
  end
38
42
  end
39
43
 
@@ -1,3 +1,3 @@
1
1
  module Propono
2
- VERSION = "0.8.0"
2
+ VERSION = "0.8.2"
3
3
  end
data/propono.gemspec CHANGED
@@ -19,7 +19,6 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ["lib"]
20
20
 
21
21
  spec.add_dependency "fog", "~> 1.15.0"
22
- spec.add_dependency "thread", "~> 0.1.1"
23
22
 
24
23
  spec.add_development_dependency "bundler", "~> 1.3"
25
24
  spec.add_development_dependency "rake"
@@ -25,6 +25,12 @@ module Propono
25
25
  assert_equal :sns, publisher.protocol
26
26
  end
27
27
 
28
+ def test_publish_logs
29
+ client = Publisher.new("foo", "bar")
30
+ Propono.config.logger.expects(:info).with() {|x| x =~ /^Propono: Publishing bar to foo via sns.*/}
31
+ client.send(:publish)
32
+ end
33
+
28
34
  def test_publish_proxies_to_sns
29
35
  publisher = Publisher.new('topic', 'message')
30
36
  publisher.expects(:publish_via_sns)
@@ -49,7 +55,8 @@ module Propono
49
55
  sns.expects(:publish).with(topic_arn, message)
50
56
  publisher = Publisher.new(topic, message)
51
57
  publisher.stubs(sns: sns)
52
- ~publisher.send(:publish_via_sns)
58
+ thread = publisher.send(:publish_via_sns)
59
+ thread.join
53
60
  end
54
61
 
55
62
  def test_publish_via_sns_should_accept_a_hash_for_message
@@ -64,9 +71,10 @@ module Propono
64
71
  sns.expects(:publish).with(topic_arn, message.to_json)
65
72
  publisher = Publisher.new(topic, message)
66
73
  publisher.stubs(sns: sns)
67
- ~publisher.send(:publish_via_sns)
74
+ thread = publisher.send(:publish_via_sns)
75
+ thread.join
68
76
  end
69
-
77
+
70
78
  def test_publish_via_sns_should_return_future_of_the_sns_response
71
79
  topic = "topic123"
72
80
  message = "message123"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: propono
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - MalcyL
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-11-01 00:00:00.000000000 Z
12
+ date: 2013-11-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fog
@@ -25,20 +25,6 @@ dependencies:
25
25
  - - ~>
26
26
  - !ruby/object:Gem::Version
27
27
  version: 1.15.0
28
- - !ruby/object:Gem::Dependency
29
- name: thread
30
- requirement: !ruby/object:Gem::Requirement
31
- requirements:
32
- - - ~>
33
- - !ruby/object:Gem::Version
34
- version: 0.1.1
35
- type: :runtime
36
- prerelease: false
37
- version_requirements: !ruby/object:Gem::Requirement
38
- requirements:
39
- - - ~>
40
- - !ruby/object:Gem::Version
41
- version: 0.1.1
42
28
  - !ruby/object:Gem::Dependency
43
29
  name: bundler
44
30
  requirement: !ruby/object:Gem::Requirement
@@ -57,42 +43,42 @@ dependencies:
57
43
  name: rake
58
44
  requirement: !ruby/object:Gem::Requirement
59
45
  requirements:
60
- - - ! '>='
46
+ - - '>='
61
47
  - !ruby/object:Gem::Version
62
48
  version: '0'
63
49
  type: :development
64
50
  prerelease: false
65
51
  version_requirements: !ruby/object:Gem::Requirement
66
52
  requirements:
67
- - - ! '>='
53
+ - - '>='
68
54
  - !ruby/object:Gem::Version
69
55
  version: '0'
70
56
  - !ruby/object:Gem::Dependency
71
57
  name: mocha
72
58
  requirement: !ruby/object:Gem::Requirement
73
59
  requirements:
74
- - - ! '>='
60
+ - - '>='
75
61
  - !ruby/object:Gem::Version
76
62
  version: '0'
77
63
  type: :development
78
64
  prerelease: false
79
65
  version_requirements: !ruby/object:Gem::Requirement
80
66
  requirements:
81
- - - ! '>='
67
+ - - '>='
82
68
  - !ruby/object:Gem::Version
83
69
  version: '0'
84
70
  - !ruby/object:Gem::Dependency
85
71
  name: yard
86
72
  requirement: !ruby/object:Gem::Requirement
87
73
  requirements:
88
- - - ! '>='
74
+ - - '>='
89
75
  - !ruby/object:Gem::Version
90
76
  version: '0'
91
77
  type: :development
92
78
  prerelease: false
93
79
  version_requirements: !ruby/object:Gem::Requirement
94
80
  requirements:
95
- - - ! '>='
81
+ - - '>='
96
82
  - !ruby/object:Gem::Version
97
83
  version: '0'
98
84
  - !ruby/object:Gem::Dependency
@@ -177,17 +163,17 @@ require_paths:
177
163
  - lib
178
164
  required_ruby_version: !ruby/object:Gem::Requirement
179
165
  requirements:
180
- - - ! '>='
166
+ - - '>='
181
167
  - !ruby/object:Gem::Version
182
168
  version: '0'
183
169
  required_rubygems_version: !ruby/object:Gem::Requirement
184
170
  requirements:
185
- - - ! '>='
171
+ - - '>='
186
172
  - !ruby/object:Gem::Version
187
173
  version: '0'
188
174
  requirements: []
189
175
  rubyforge_project:
190
- rubygems_version: 2.1.9
176
+ rubygems_version: 2.0.3
191
177
  signing_key:
192
178
  specification_version: 4
193
179
  summary: General purpose pub/sub library built on top of AWS SNS and SQS