koinz 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
- Rails.logger.info("Subscribed to ##{event} (#{total} subscriptions)")
22
+ log("Subscribed to ##{event} (#{total} subscriptions)")
23
23
  end
24
24
 
25
25
  on.pmessage do |pattern, event, message|
26
- block.call(event, MultiJson.decode(message))
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
- Rails.logger.info("Unsubscribed for ##{event} (#{total} subscriptions)")
34
+ log("Unsubscribed for ##{event} (#{total} subscriptions)")
31
35
  end
32
36
  end
33
37
  end
34
- Rails.logger.info("Exiting Koinz::Notification.subscribe")
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
@@ -1,3 +1,3 @@
1
1
  module Koinz
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
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: 19
4
+ hash: 17
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 6
10
- version: 0.0.6
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-17 00:00:00 +05:30
18
+ date: 2011-01-18 00:00:00 +05:30
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency