koinz 0.0.6 → 0.0.7
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.
- data/lib/koinz/notification.rb +14 -4
- data/lib/koinz/version.rb +1 -1
- metadata +4 -4
data/lib/koinz/notification.rb
CHANGED
@@ -19,19 +19,23 @@ module Koinz
|
|
19
19
|
|
20
20
|
REDIS_SUB.psubscribe(*(events.flatten)) do |on|
|
21
21
|
on.psubscribe do |event, total|
|
22
|
-
|
22
|
+
log("Subscribed to ##{event} (#{total} subscriptions)")
|
23
23
|
end
|
24
24
|
|
25
25
|
on.pmessage do |pattern, event, message|
|
26
|
-
|
26
|
+
begin
|
27
|
+
block.call(event, MultiJson.decode(message))
|
28
|
+
rescue Exception => e
|
29
|
+
log("Exception in subscribe: #{e.message}")
|
30
|
+
end
|
27
31
|
end
|
28
32
|
|
29
33
|
on.punsubscribe do |event, total|
|
30
|
-
|
34
|
+
log("Unsubscribed for ##{event} (#{total} subscriptions)")
|
31
35
|
end
|
32
36
|
end
|
33
37
|
end
|
34
|
-
|
38
|
+
log("Exiting Koinz::Notification.subscribe")
|
35
39
|
end
|
36
40
|
|
37
41
|
def self.publish(event, payload)
|
@@ -41,5 +45,11 @@ module Koinz
|
|
41
45
|
def self.email(payload)
|
42
46
|
publish('koinz.notification.email', payload)
|
43
47
|
end
|
48
|
+
|
49
|
+
private
|
50
|
+
# Need to make this more configurable -- with loggers. Currently using Rails.logger
|
51
|
+
def self.log(message)
|
52
|
+
Rails.logger.info(message)
|
53
|
+
end
|
44
54
|
end
|
45
55
|
end
|
data/lib/koinz/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: koinz
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 7
|
10
|
+
version: 0.0.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Gautam Rege
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-01-
|
18
|
+
date: 2011-01-18 00:00:00 +05:30
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|