Skip to content

Commit 0daa6df

Browse files
author
Michael Holloway
committed
EPC: Remove unnecessary rechecks immediately before posting events
1 parent c71e817 commit 0daa6df

File tree

1 file changed

+1
-18
lines changed

1 file changed

+1
-18
lines changed

WMF Framework/Event Platform/EventPlatformClient.swift

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -404,23 +404,6 @@ public class EventPlatformClient: NSObject, SamplingControllerDelegate {
404404
let group = DispatchGroup()
405405
for event in events {
406406
group.enter()
407-
408-
guard let streamConfig = streamConfigs[event.stream] else {
409-
/// Stream is not configured.
410-
DDLogWarn("EPC: Event submitted for stream '\(event.stream.rawValue)' but only the following streams are configured: \(streamConfigs.keys.map(\.rawValue).joined(separator: ", "))")
411-
storageManager.markPurgeable(event: event)
412-
group.leave()
413-
continue
414-
}
415-
416-
guard samplingController.inSample(stream: event.stream, config: streamConfig) else {
417-
/// Stream is out of sample. Mark as failed so it will be dropped from storage on the next cleanup.
418-
DDLogDebug("EPC: Stream '\(event.stream.rawValue)' is not in sample")
419-
storageManager.markPurgeable(event: event)
420-
group.leave()
421-
continue
422-
}
423-
424407
httpPost(url: EventPlatformClient.eventIntakeURI, body: event.data) { result in
425408
switch result {
426409
case .success:
@@ -614,12 +597,12 @@ public class EventPlatformClient: NSObject, SamplingControllerDelegate {
614597
appendEventToInputBuffer(data: data, stream: stream)
615598
return
616599
}
617-
618600
guard let config = streamConfigs[stream] else {
619601
DDLogDebug("EPC: Event submitted to '\(stream)' but only the following streams are configured: \(streamConfigs.keys.map(\.rawValue).joined(separator: ", "))")
620602
return
621603
}
622604
guard samplingController.inSample(stream: stream, config: config) else {
605+
DDLogDebug("EPC: Stream '\(event.stream.rawValue)' is not in sample")
623606
return
624607
}
625608
storageManager.push(data: data, stream: stream)

0 commit comments

Comments
 (0)