Skip to content

Commit b1730b6

Browse files
committed
Fix worker perform interface
1 parent 4332112 commit b1730b6

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

lib/datadog/open_feature/exposures/worker.rb

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,26 +66,24 @@ def dequeue
6666
end
6767

6868
def flush
69-
send_events(*dequeue)
69+
events, dropped = dequeue
70+
send_events(events || [], dropped || 0)
7071
end
7172

7273
def perform(*args)
73-
send_events(*args)
74+
events, dropped = args
75+
send_events(events || [], dropped || 0)
7476
end
7577

7678
private
7779

78-
def send_events(events, dropped = 0)
79-
events ||= []
80+
def send_events(events, dropped)
81+
return if events.empty?
8082

8183
if dropped.positive?
82-
logger.debug do
83-
"OpenFeature: Exposure worker dropped #{dropped} event(s) due to full buffer"
84-
end
84+
logger.debug { "OpenFeature: Exposure worker dropped #{dropped} event(s) due to full buffer" }
8585
end
8686

87-
return if events.empty?
88-
8987
payload = Batch.new(context: @context_builder.call, exposures: events).to_h
9088
send_payload(payload)
9189
end

sig/datadog/open_feature/exposures/worker.rbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ module Datadog
3838

3939
def perform: (*untyped) -> void
4040

41-
def send_events: (::Array[Exposures::Event]?, ::Integer) -> void
41+
def send_events: (::Array[Exposures::Event], ::Integer) -> void
4242

4343
def send_payload: (::Hash[::Symbol, untyped]) -> Core::Transport::Response?
4444
end

0 commit comments

Comments
 (0)