Skip to content

Commit 47c1e3a

Browse files
committed
WIP
1 parent c0988c5 commit 47c1e3a

File tree

1 file changed

+4
-25
lines changed

1 file changed

+4
-25
lines changed

sentry-ruby/lib/sentry/backtrace.rb

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -32,36 +32,16 @@ def self.parse(backtrace, project_root, app_dirs_pattern, &backtrace_cleanup_cal
3232
# @see https://github.com/rails/rails/pull/49095 for more context.
3333
if Thread.respond_to?(:each_caller_location)
3434
def self.source_location(backtrace_cleaner)
35-
cache = line_cache.fetch_or_store(backtrace_cleaner.__id__) { Concurrent::Map.new }
36-
3735
Thread.each_caller_location do |location|
38-
frame_key = [location.absolute_path, location.lineno]
39-
cached_value = cache[frame_key]
40-
41-
next if cached_value == :skip
42-
43-
if cached_value
44-
return cached_value
45-
else
46-
cleaned_frame = backtrace_cleaner.clean_frame(location)
47-
48-
if cleaned_frame
49-
line = Line.from_source_location(location)
50-
cache[frame_key] = line
36+
cleaned_frame = backtrace_cleaner.clean_frame(location)
5137

52-
return line
53-
else
54-
cache[frame_key] = :skip
38+
next unless cleaned_frame
5539

56-
next
57-
end
40+
if cleaned_frame
41+
return Line.from_source_location(location)
5842
end
5943
end
6044
end
61-
62-
def self.line_cache
63-
@line_cache ||= Concurrent::Map.new
64-
end
6545
else
6646
# Since Sentry is mostly used in production, we don't want to fallback
6747
# to the slower implementation and adds potentially big overhead to the
@@ -71,7 +51,6 @@ def self.source_location(*)
7151
end
7252
end
7353

74-
7554
def initialize(lines)
7655
@lines = lines
7756
end

0 commit comments

Comments
 (0)