@@ -13,6 +13,7 @@ public class Reporter {
1313 private let dispatchQueue = DispatchQueue ( label: " com.instana.ios.agent.reporter " , qos: . utility)
1414 private var sendFirstBeacon = true // first beacon is sent all by itself, not in a batch
1515 private var slowSendStartTime : Date ?
16+ private var inSlowModeBeforeFlush = false
1617 private var flusher : BeaconFlusher ?
1718 internal var send : BeaconFlusher . Sender ?
1819 private let rateLimiter : ReporterRateLimiter
@@ -142,7 +143,8 @@ public class Reporter {
142143 return handle ( flushResult: . failure( [ InstanaError . lowBattery] ) )
143144 }
144145 var beacons : Set < CoreBeacon > = Set ( [ ] )
145- if isInSlowSendMode {
146+ inSlowModeBeforeFlush = isInSlowSendMode
147+ if inSlowModeBeforeFlush {
146148 if sendFirstBeacon {
147149 debounce = flushDebounce
148150 sendFirstBeacon = false
@@ -198,5 +200,18 @@ public class Reporter {
198200 guard let self = self else { return }
199201 self . completionHandler. forEach { $0 ( result) }
200202 }
203+
204+ if inSlowModeBeforeFlush {
205+ // Another flush either resend 1 beacon (still in slow mode currently)
206+ // or flush remaing beacons (got out of slow send mode already)
207+ var msg : String
208+ if isInSlowSendMode {
209+ msg = " schedule flush to send 1 beacon in slow send mode "
210+ } else {
211+ msg = " flush all beacons after out of slow send mode "
212+ }
213+ session. logger. add ( msg)
214+ scheduleFlush ( )
215+ }
201216 }
202217}
0 commit comments