Skip to content

Commit

Permalink
memoize inheritable tags in TestSession
Browse files Browse the repository at this point in the history
  • Loading branch information
anmarchenko committed Nov 22, 2023
1 parent 550d0d3 commit 56d0c20
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/datadog/ci/test_session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ def finish
end

def inheritable_tags
return @inheritable_tags if defined?(@inheritable_tags)

# this method is not synchronized because it does not iterate over the tags, but rather
# uses synchronized method to get each tag value
res = {}
Ext::Test::INHERITABLE_TAGS.each do |tag|
res[tag] = get_tag(tag)
end
res
@inheritable_tags = res
end
end
end
Expand Down
2 changes: 2 additions & 0 deletions sig/datadog/ci/test_session.rbs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module Datadog
module CI
class TestSession < ConcurrentSpan
@inheritable_tags: Hash[untyped, untyped]

def inheritable_tags: () -> Hash[untyped, untyped]
end
end
Expand Down

0 comments on commit 56d0c20

Please sign in to comment.