simplepubsub 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eb381f1a9193783cec4ec0e89707d8cf09ea4b59
4
- data.tar.gz: f7073225dd5c8429af8cdc86fd107e494022f033
3
+ metadata.gz: ae7553c303ff5df3f6d11c22139545578859b406
4
+ data.tar.gz: 8d73b563bdc82f7310283d79373209f5fa8d633c
5
5
  SHA512:
6
- metadata.gz: 3a80c6ee14fa0364868a3160570c103629d2ed2702f83cb5917b231bb07ad7114c54a5e08837afaabd128f4a04fdc14b1861d7fe6ac2103810de04ce5e260169
7
- data.tar.gz: ad4f5f78400633816e44c4e2d8757f5805396342623a6629a6361225d03e3323f0528d88f294736c7caabd52b6184f8cc26ad6e6b1419ac37dd9a7143f61db25
6
+ metadata.gz: 4329603a8f15a84e48943d2c5dc2cbcc749c342aed1ad8bb63cfa4dbc4b96e45834be0f24ebb439090d6dcc583d60aec9fe39580a62b849b2befb853e0c79536
7
+ data.tar.gz: 6ac2a06f64e8ee0727a787aa5c0823b045353c35aa82d0a6e036c2e1888ec21850b9e720ef5cae1676bf9c42e135d619f00e9efcb7d83b64d64b604b12e6938b
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/simplepubsub.rb CHANGED
@@ -5,9 +5,9 @@
5
5
  require 'open-uri'
6
6
  require 'drb'
7
7
  require 'dws-registry'
8
+ require 'socket'
8
9
 
9
-
10
- USER_AGENT = 'SimplePubSub client 0.4.0'
10
+ USER_AGENT = 'SimplePubSub client 0.4'
11
11
 
12
12
  module SimplePubSub
13
13
 
@@ -67,7 +67,7 @@ module SimplePubSub
67
67
 
68
68
  attr_reader :subscribers, :bridges
69
69
 
70
- def initialize(hostname, raw_reg='simplepubsub.xml')
70
+ def initialize(raw_reg='simplepubsub.xml')
71
71
 
72
72
 
73
73
  h = {DWSRegistry: ->{raw_reg}, String: ->{DWSRegistry.new raw_reg}}
@@ -77,7 +77,7 @@ module SimplePubSub
77
77
  # try to read the subscribers
78
78
  topics = @reg.get_key 'hkey_apps/simplepubsub/subscription_topics'
79
79
 
80
- @hostname = hostname
80
+ @hostname = Socket.gethostname
81
81
  @subscribers, @bridges = {'#' => []}, {'#' => {}}
82
82
 
83
83
  if topics then
@@ -165,43 +165,47 @@ module SimplePubSub
165
165
 
166
166
  topic_subscribers.each do |uri|
167
167
 
168
- next if @subscribers['#'].include? uri
169
- echo = DRbObject.new nil, uri
168
+ next if @subscribers['#'].include? uri
170
169
 
171
- begin
172
- echo.message topic, msg
173
- rescue DRb::DRbConnError => e
170
+ Thread.new {
171
+ echo = DRbObject.new nil, uri
174
172
 
175
- @subscribers[topic].delete uri
176
-
177
- if @subscribers[topic].empty? then
178
- @subscribers.delete topic
179
- key = "hkey_apps/simplepubsub/subscription_topics/%s" % [topic]
180
- else
181
- key = "hkey_apps/simplepubsub/subscription_topics/%s/subscribers/%s" % \
182
- [topic, uri[/[^\/]+$/].sub(':','')]
183
- end
184
-
185
- @reg.delete_key key
186
-
187
- end
173
+ begin
174
+ echo.message topic, msg
175
+ rescue DRb::DRbConnError => e
176
+
177
+ @subscribers[topic].delete uri
178
+
179
+ if @subscribers[topic].empty? then
180
+ @subscribers.delete topic
181
+ key = "hkey_apps/simplepubsub/subscription_topics/%s" % [topic]
182
+ else
183
+ key = "hkey_apps/simplepubsub/subscription_topics/%s/subscribers/%s" % \
184
+ [topic, uri[/[^\/]+$/].sub(':','')]
185
+ end
186
+
187
+ @reg.delete_key key
188
+
189
+ end
190
+ }
188
191
 
189
192
  end
190
193
  end
191
194
 
192
195
  @subscribers['#'].each do |uri|
193
-
194
- echo = DRbObject.new nil, uri
195
-
196
- begin
197
- echo.message topic, msg
198
- rescue DRb::DRbConnError => e
196
+ Thread.new {
197
+ echo = DRbObject.new nil, uri
199
198
 
200
- @subscribers['#'].delete uri
201
- key = "hkey_apps/simplepubsub/subscription_all_topics/subscribers/%s" % \
202
- [uri[/[^\/]+$/].sub(':','')]
203
- @reg.delete_key key
204
- end
199
+ begin
200
+ echo.message topic, msg
201
+ rescue DRb::DRbConnError => e
202
+
203
+ @subscribers['#'].delete uri
204
+ key = "hkey_apps/simplepubsub/subscription_all_topics/subscribers/%s" % \
205
+ [uri[/[^\/]+$/].sub(':','')]
206
+ @reg.delete_key key
207
+ end
208
+ }
205
209
 
206
210
  end
207
211
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simplepubsub
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -31,7 +31,7 @@ cert_chain:
31
31
  i0PBE6fLwlIMk8jNNUcX3J1csSMgLNTwE8CwrlSZE8sueHj0pQzICM7lF0gGREO6
32
32
  hQHD0LljU3MusQ==
33
33
  -----END CERTIFICATE-----
34
- date: 2013-07-18 00:00:00.000000000 Z
34
+ date: 2013-07-20 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: dws-registry
metadata.gz.sig CHANGED
Binary file