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

Allow toggling background sending on the fly #1447

Merged
merged 2 commits into from
May 20, 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
6 changes: 6 additions & 0 deletions sentry-ruby/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## Unreleased

### Bug Fixes

- Allow toggling background sending on the fly [#1447](https://github.com/getsentry/sentry-ruby/pull/1447)

## 4.4.2

- Fix NoMethodError when SDK's dsn is nil [#1433](https://github.com/getsentry/sentry-ruby/pull/1433)
Expand Down
2 changes: 1 addition & 1 deletion sentry-ruby/lib/sentry/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def capture_event(event, scope, hint = {})

if async_block = configuration.async
dispatch_async_event(async_block, event, hint)
elsif hint.fetch(:background, true)
elsif configuration.background_worker_threads != 0 && hint.fetch(:background, true)
dispatch_background_event(event, hint)
else
send_event(event, hint)
Expand Down
10 changes: 10 additions & 0 deletions sentry-ruby/spec/sentry/client/event_sending_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,16 @@
expect(transport.events.count).to eq(1)
end
end

context "with config.background_worker_threads set to 0 on the fly" do
it "sends the event immediately" do
configuration.background_worker_threads = 0

subject.capture_event(event, scope)

expect(transport.events.count).to eq(1)
end
end
end
end

Expand Down