chore 0.2.1 → 0.2.2

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.
Files changed (3) hide show
  1. data/lib/chore.rb +11 -0
  2. data/lib/chore/server.rb +3 -0
  3. metadata +2 -2
data/lib/chore.rb CHANGED
@@ -105,6 +105,17 @@ private
105
105
 
106
106
  #only allow good options
107
107
  def self.sanitize msg
108
+ # excessively large messages are too big for a UDP packet
109
+ opts = msg[2]
110
+ opts.keys.each do |key|
111
+ next if !opts[key].is_a? String
112
+
113
+ if opts[key].length > 1024
114
+ puts "FIXING"
115
+ opts[key] = opts[key][0..1020] + "..."
116
+ end
117
+ end
118
+
108
119
  msg.to_json
109
120
  end
110
121
  end
data/lib/chore/server.rb CHANGED
@@ -18,6 +18,9 @@ module ChoreCollect
18
18
  def receive_data(data)
19
19
  chore_info = JSON.parse(data)
20
20
  chore_collect chore_info
21
+ rescue JSON::ParserError => ex
22
+ warn "Ignoring invalid json, it probalby got truncated"
23
+ warn data
21
24
  end
22
25
  end
23
26
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: chore
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.2.1
5
+ version: 0.2.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Pikimal, LLC
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2012-06-22 00:00:00 Z
13
+ date: 2012-07-03 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: eventmachine