Skip to content

Commit 5c5cd75

Browse files
Hongyan JiangGitHub Enterprise
authored andcommitted
Prepare release 1.6.2
Once in slow send mode, periodically resend 1 beacon. Once out of slow send mode, flush all beacons immediately.
1 parent 5c383f0 commit 5c5cd75

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## 1.6.2
44
- [Tech Preview] Add sample code in InstanaAgentExample app on how to enable crash reporting to Instana backend
5+
- Once in slow send mode, periodically resend 1 beacon. Once out of slow send mode, flush all beacons immediately.
56

67
## 1.6.1
78
- Fix crash caused by appendMetaData() inside InstanaProperties class

Sources/InstanaAgent/Beacons/Reporter.swift

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)