airbrake-ruby 4.4.0 → 4.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0e642b4f41129e726c7f8107ca0d1eeb6880a701
4
- data.tar.gz: 01f580af59e4108972b56ea5dd2cc9eb00e40140
3
+ metadata.gz: b9aea7ecb085e30e5e237e2a2299265d1df6b950
4
+ data.tar.gz: 7d2a2130e69749306f0792eb786237122b0bd514
5
5
  SHA512:
6
- metadata.gz: 3fcf97fff4a036e3be64919f31b38c6e195ff71b9e108181026c9a18d11ce89ab32bd59b496563c967d861d89014e60e2d4d84c3d18f81627c916f3628b35c58
7
- data.tar.gz: 17923e72b4a4938fff36c4feb68df58fea240a96d957c72866feae53b920c3dcfee5ba3fcf5c3a2354279ef309156c2d7879856035454eccca7e8b0109ff58fc
6
+ metadata.gz: c78add83dd9ec84df8f1031ba1233a85eac988ce3c57cbd08b419ec67f7f609fe54ceaf16669dd3a0d80d24621a8254693604e264e8213ce9bd826ad1f16588d
7
+ data.tar.gz: 61587145c472a7be1a62ace1cb426f7aa766318676c4999b3fabb6570aaf813d181f5e553ae17edf7e1c08e8f9b99bda5693f682595c7489b22c55653175bd4b
@@ -9,6 +9,12 @@ module Airbrake
9
9
  class AsyncSender
10
10
  include Loggable
11
11
 
12
+ # @return [String]
13
+ WILL_NOT_DELIVER_MSG =
14
+ "%<log_label>s AsyncSender has reached its capacity of %<capacity>s " \
15
+ "and the following notice will not be delivered " \
16
+ "Error: %<type>s - %<message>s\nBacktrace: %<backtrace>s\n".freeze
17
+
12
18
  # @return [ThreadGroup] the list of workers
13
19
  # @note This is exposed for eaiser unit testing
14
20
  # @since v4.0.0
@@ -36,7 +42,7 @@ module Airbrake
36
42
  # library
37
43
  # @return [Airbrake::Promise]
38
44
  def send(notice, promise)
39
- return will_not_deliver(notice) if @unsent.size >= @unsent.max
45
+ return will_not_deliver(notice, promise) if @unsent.size >= @unsent.max
40
46
 
41
47
  @unsent << [notice, promise]
42
48
  promise
@@ -115,17 +121,22 @@ module Airbrake
115
121
  end
116
122
  end
117
123
 
118
- def will_not_deliver(notice)
119
- backtrace = notice[:errors][0][:backtrace].map do |line|
120
- "#{line[:file]}:#{line[:line]} in `#{line[:function]}'"
121
- end
124
+ def will_not_deliver(notice, promise)
125
+ error = notice[:errors].first
126
+
122
127
  logger.error(
123
- "#{LOG_LABEL} AsyncSender has reached its capacity of " \
124
- "#{@unsent.max} and the following notice will not be delivered " \
125
- "Error: #{notice[:errors][0][:type]} - #{notice[:errors][0][:message]}\n" \
126
- "Backtrace: \n" + backtrace.join("\n")
128
+ format(
129
+ WILL_NOT_DELIVER_MSG,
130
+ log_label: LOG_LABEL,
131
+ capacity: @unsent.max,
132
+ type: error[:type],
133
+ message: error[:message],
134
+ backtrace: error[:backtrace].map do |line|
135
+ "#{line[:file]}:#{line[:line]} in `#{line[:function]}'"
136
+ end.join("\n")
137
+ )
127
138
  )
128
- nil
139
+ promise.reject("AsyncSender has reached its capacity of #{@unsent.max}")
129
140
  end
130
141
  end
131
142
  end
@@ -130,7 +130,7 @@ module Airbrake
130
130
  )
131
131
 
132
132
  self.versions = {}
133
- self.performance_stats = false
133
+ self.performance_stats = true
134
134
  self.performance_stats_flush_period = 15
135
135
 
136
136
  merge(user_config)
@@ -2,5 +2,5 @@
2
2
  # More information: http://semver.org/
3
3
  module Airbrake
4
4
  # @return [String] the library version
5
- AIRBRAKE_RUBY_VERSION = '4.4.0'.freeze
5
+ AIRBRAKE_RUBY_VERSION = '4.5.0'.freeze
6
6
  end
@@ -49,6 +49,14 @@ RSpec.describe Airbrake::AsyncSender do
49
49
  end
50
50
  subject.close
51
51
  end
52
+
53
+ it "returns a rejected promise" do
54
+ promise = Airbrake::Promise.new
55
+ 200.times { subject.send(notice, promise) }
56
+ expect(promise.value).to eq(
57
+ 'error' => "AsyncSender has reached its capacity of #{queue_size}"
58
+ )
59
+ end
52
60
  end
53
61
  end
54
62
 
@@ -19,7 +19,7 @@ RSpec.describe Airbrake::Config do
19
19
  its(:timeout) { is_expected.to be_nil }
20
20
  its(:blacklist_keys) { is_expected.to be_empty }
21
21
  its(:whitelist_keys) { is_expected.to be_empty }
22
- its(:performance_stats) { is_expected.to be_falsey }
22
+ its(:performance_stats) { is_expected.to eq(true) }
23
23
  its(:performance_stats_flush_period) { is_expected.to eq(15) }
24
24
 
25
25
  describe "#new" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: airbrake-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.4.0
4
+ version: 4.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Airbrake Technologies, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-09 00:00:00.000000000 Z
11
+ date: 2019-06-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rbtree3