airbrake-ruby 4.4.0-java → 4.5.0-java

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: a042baeefd9b06eb7c57113c0281dfa5b5ea6916
4
- data.tar.gz: e5cbde788fce2450987c0bb0bdf6246f56566b75
3
+ metadata.gz: d4e58a8ab700b97a73bb42e4dbbecdb34b383607
4
+ data.tar.gz: 7d2a2130e69749306f0792eb786237122b0bd514
5
5
  SHA512:
6
- metadata.gz: 8d02a2bd6ac6612a0fead741833f4a2afb44e1544c49bde1f2c2b757a408f28e2f231fb531824707cbc2692581b2348fcb27a9779855221b6e3c58db373a0f54
7
- data.tar.gz: f8eb77c77d9727a785f197a23c50824c1e094f404dbe3eb3b115a6c0be343ad65746076e0ce13597c165b096af18cce1c6fce23c4a474e94bb061a02b20d5b90
6
+ metadata.gz: 795644660b305c160cdc8e94efd72c803112680ad65a5229516ac2a0faab59cd346ede0a1c264932adc7a0f1c412fbaeb5347f9d9181fe5fc3f8dcd3ee485192
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: java
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: rbtree-jruby