carnivore 0.2.14 → 0.2.16

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: 5231bc41dbed7367377f1090aef03e9bbee7d35d
4
- data.tar.gz: 7fc77f64f2443a3b0e07d1f4ceb38117b79faf32
3
+ metadata.gz: 011ab8b22ae76b8be44ce315fcf7a9b1a1a136c4
4
+ data.tar.gz: aefffbceab3c592743e3a542cb5b226822cfaae1
5
5
  SHA512:
6
- metadata.gz: 665982fe147949291c8143a2c8889d0cd23a37cc9c84aa183596adfa83783d49cdbbf7f484d85a8f0369e5c34e31bdfae7cc66fbea23aaff9ead9f9e3f472bc8
7
- data.tar.gz: 8d288bb58031d309972e052fccba97a37b70a2fe36554169c2cd06d809af5262a47d1b68c9e55aa8cb0d8627fdbb2087eac29d97265c07bd3cd4f0c4ccb5446f
6
+ metadata.gz: 15f085834d83fc162c2f3f937e695cd7a4ebafa3896103b2d73455c067f64f8211e1a97526527263c3805917428c87cae6b6cbb0d2bf79cd36c1f0a17c8433d3
7
+ data.tar.gz: 55dd49f607ce11a731c2d4155b3fbb758ebbf009c59917499e9222bc1df55cd1f0c5e6f67d197c5f4b99aab062adc46e070f4ec62e6062e172880805f55cca87
@@ -1,3 +1,9 @@
1
+ # v0.2.16
2
+ * Log incoming messages at info level
3
+ * Add Source#touch method
4
+ * Rescue and log encoding errors on transmission (prevent fatal teardown)
5
+ * Add Message#touch proxy helper
6
+
1
7
  # v0.2.14
2
8
  * Always return `Smash` types when config value is `Hash`
3
9
 
@@ -64,7 +64,7 @@ module Carnivore
64
64
  def call(message)
65
65
  begin
66
66
  if(valid?(message))
67
- debug ">> Received message is valid for this callback (#{message})"
67
+ info ">> Received message is valid for this callback (#{message})"
68
68
  execute(message)
69
69
  else
70
70
  debug "Invalid message for this callback #{message})"
@@ -36,6 +36,13 @@ module Carnivore
36
36
  self[:source].confirm(*([self] + args).flatten(1).compact)
37
37
  end
38
38
 
39
+ # Touch message on source
40
+ #
41
+ # @return [TrueClass, FalseClass]
42
+ def touch!
43
+ self[:source].touch(self)
44
+ end
45
+
39
46
  # @return [String] formatted inspection string
40
47
  def inspect
41
48
  "<Carnivore::Message[#{self.object_id}] @args=#{args.inspect}>"
@@ -257,6 +257,15 @@ module Carnivore
257
257
  raise NotImplemented.new('Abstract method not valid for runtime')
258
258
  end
259
259
 
260
+ # Touch message to reset timeout
261
+ #
262
+ # @param message [Carnivore::Message]
263
+ # @return [TrueClass, FalseClass]
264
+ def touch(message)
265
+ warn 'Source#touch was not implemented for this source!'
266
+ true
267
+ end
268
+
260
269
  # Confirm receipt of the message on source
261
270
  #
262
271
  # @param message [Carnivore::Message]
@@ -435,14 +444,19 @@ module Carnivore
435
444
  # Send to local loop if processing otherwise use regular transmit
436
445
  #
437
446
  # @param args [Object] argument list
438
- # @return [TrueClass]
447
+ # @return [TrueClass, FalseClass]
439
448
  def _transmit(*args)
440
- if(loop_enabled? && processing)
441
- loop_transmit(*args)
442
- else
443
- custom_transmit(*args)
449
+ begin
450
+ if(loop_enabled? && processing)
451
+ loop_transmit(*args)
452
+ else
453
+ custom_transmit(*args)
454
+ end
455
+ true
456
+ rescue EncodingError => e
457
+ error "Transmission failed due to encoding error! Error: #{e.class} - #{e} [(#{args.map(&:to_s).join(')(')})]"
458
+ false
444
459
  end
445
- true
446
460
  end
447
461
 
448
462
  # Local message loopback is enabled. Custom sources should
@@ -1,4 +1,4 @@
1
1
  module Carnivore
2
2
  # Current version of library
3
- VERSION = Gem::Version.new('0.2.14')
3
+ VERSION = Gem::Version.new('0.2.16')
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: carnivore
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.14
4
+ version: 0.2.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Roberts
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-21 00:00:00.000000000 Z
11
+ date: 2014-12-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: celluloid