From 8c1c259f7d288052e90dea15e3aa8b48c5c21c20 Mon Sep 17 00:00:00 2001 From: Koo Date: Mon, 12 Aug 2024 06:33:58 +0900 Subject: [PATCH] Use `Concurrent.available_processor_count` instead of `Concurrent.usable_processor_count` (#2358) --- CHANGELOG.md | 2 ++ sentry-ruby/lib/sentry/configuration.rb | 7 ++----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8870a20c5..352ef2472 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ### Features +- Use `Concurrent.available_processor_count` instead of `Concurrent.usable_processor_count` ([#2358](https://github.com/getsentry/sentry-ruby/pull/2358)) + - Support for tracing Faraday requests ([#2345](https://github.com/getsentry/sentry-ruby/pull/2345)) - Closes [#1795](https://github.com/getsentry/sentry-ruby/issues/1795) - Please note that the Faraday instrumentation has some limitations in case of async requests: https://github.com/lostisland/faraday/issues/1381 diff --git a/sentry-ruby/lib/sentry/configuration.rb b/sentry-ruby/lib/sentry/configuration.rb index 8d4564694..480172a88 100644 --- a/sentry-ruby/lib/sentry/configuration.rb +++ b/sentry-ruby/lib/sentry/configuration.rb @@ -656,11 +656,8 @@ def run_post_initialization_callbacks end def processor_count - if Concurrent.respond_to?(:usable_processor_count) - Concurrent.usable_processor_count - else - Concurrent.processor_count - end + available_processor_count = Concurrent.available_processor_count if Concurrent.respond_to?(:available_processor_count) + available_processor_count || Concurrent.processor_count end end end