ridc 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/exception_reporter.rb +9 -12
  2. data/lib/sender.rb +13 -5
  3. metadata +2 -2
@@ -9,17 +9,14 @@ class Ridc::ExceptionReporter
9
9
  response = @app.call(env)
10
10
  rescue Exception => exception
11
11
  report(exception, env)
12
-
13
-
14
12
  raise exception
15
13
  end
16
14
 
17
15
  def report(exception, environment)
18
-
19
16
  event_session_id = Thread.current["session_id"]
20
17
  event_session_content = Thread.current["session_content"]
21
18
  event = {
22
- :exception => exception,
19
+ :exception => exception.clone, # TODO signature is failing because of this,
23
20
  :environment => useful_environment_parts(environment),
24
21
  :event_session_id => event_session_id,
25
22
  :event_session_content => event_session_content
@@ -30,14 +27,14 @@ class Ridc::ExceptionReporter
30
27
  # thanks raygun4ruby guys!
31
28
  def useful_environment_parts(env)
32
29
  {
33
- hostName: env["SERVER_NAME"],
34
- url: env["PATH_INFO"],
35
- httpMethod: env["REQUEST_METHOD"],
36
- ipAddress: env["REMOTE_ADDR"],
37
- queryString: Rack::Utils.parse_nested_query(env["QUERY_STRING"]),
38
- form: form_data(env),
39
- headers: headers(env),
40
- rawData: []
30
+ :hostName => env["SERVER_NAME"],
31
+ :url => env["PATH_INFO"],
32
+ :httpMethod => env["REQUEST_METHOD"],
33
+ :ipAddress => env["REMOTE_ADDR"],
34
+ :queryString => Rack::Utils.parse_nested_query(env["QUERY_STRING"]),
35
+ :form => form_data(env),
36
+ :headers => headers(env),
37
+ :rawData => []
41
38
  }
42
39
  end
43
40
  def headers(rack_env)
data/lib/sender.rb CHANGED
@@ -73,11 +73,19 @@ module Ridc
73
73
 
74
74
  def send_all_events
75
75
  loop do
76
- body = @queue.pop(true)
77
- unless body.nil?
78
- send_request(body)
79
- else
80
- sleep(SEND_LOOP_DELAY_S)
76
+ begin
77
+ if @queue.empty?
78
+ sleep(SEND_LOOP_DELAY_S)
79
+ else
80
+ body = @queue.pop(true)
81
+ unless body.nil?
82
+ send_request(body)
83
+ else
84
+ sleep(SEND_LOOP_DELAY_S)
85
+ end
86
+ end
87
+ rescue Exception => e
88
+ Rails.logger.original.error(e)
81
89
  end
82
90
  end
83
91
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ridc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-11-25 00:00:00.000000000 Z
13
+ date: 2013-12-08 00:00:00.000000000 Z
14
14
  dependencies: []
15
15
  description: ''
16
16
  email: