Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

thread_pool: change severity of "full queue" msg from error to info #667

Merged
merged 3 commits into from
Oct 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,6 @@ RSpec/MultipleMemoizedHelpers:

RSpec/AnyInstance:
Enabled: false

Layout/LineEndStringConcatenationIndentation:
Enabled: false
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ Airbrake Ruby Changelog

### master

* Changed the severity of the log message that gets printed when AsyncSender's
thread pool capacity reaches the limit from `error` to `info`. With this new
severity the message will be silenced by default.
([#667](https://github.com/airbrake/airbrake-ruby/pull/667))

### [v6.0.0][v6.0.0] (September 20, 2021)

Breaking changes:
Expand Down
2 changes: 1 addition & 1 deletion lib/airbrake-ruby/filters/git_last_checkout_filter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def last_checkout_line
return unless File.exist?(head_path)

last_line = nil
IO.foreach(head_path) do |line|
File.foreach(head_path) do |line|
last_line = line if checkout_line?(line)
end
last_line
Expand Down
6 changes: 3 additions & 3 deletions lib/airbrake-ruby/thread_pool.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ def initialize(worker_size:, queue_size:, block:, name: nil)
# false if the queue is full
def <<(message)
if backlog >= @queue_size
logger.error(
logger.info do
"#{LOG_LABEL} ThreadPool has reached its capacity of " \
"#{@queue_size} and the following message will not be " \
"processed: #{message.inspect}",
)
"processed: #{message.inspect}"
end
return false
end

Expand Down
2 changes: 1 addition & 1 deletion spec/filters/git_revision_filter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
end
end

context "and also when HEAD starts with 'ref: " do
context "and also when HEAD starts with 'ref: '" do
before do
allow(File).to(
receive(:read).with('root/dir/.git/HEAD').and_return("ref: refs/foo\n"),
Expand Down
7 changes: 3 additions & 4 deletions spec/thread_pool_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,13 @@
end

it "logs discarded tasks" do
allow(Airbrake::Loggable.instance).to receive(:error)
allow(Airbrake::Loggable.instance).to receive(:info)

15.times { full_thread_pool << 1 }
full_thread_pool.close

expect(Airbrake::Loggable.instance).to have_received(:error).with(
/reached its capacity/,
).exactly(15).times
expect(Airbrake::Loggable.instance)
.to have_received(:info).exactly(15).times
end
end
end
Expand Down