Skip to content

Commit

Permalink
perf (iOS/all operations): we now launch logging and progress% callba…
Browse files Browse the repository at this point in the history
…cks in the background so that the file-uploading/downloading aspects will be unimpeded
  • Loading branch information
ksidirop-laerdal committed Jan 17, 2025
1 parent fcbec31 commit ca8a335
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,9 @@ public class IOSFileDownloader: NSObject {

//@objc dont
private func logMessageAdvertisement(_ message: String, _ category: String, _ level: String) {
_listener.logMessageAdvertisement(message, category, level, _remoteFilePathSanitized)
DispatchQueue.global(qos: .background).async { //fire and forget to boost performance
self._listener.logMessageAdvertisement(message, category, level, self._remoteFilePathSanitized)
}
}

//@objc dont
Expand All @@ -218,7 +220,9 @@ public class IOSFileDownloader: NSObject {
_ progressPercentage: Int,
_ averageThroughput: Float32
) {
_listener.fileDownloadProgressPercentageAndDataThroughputChangedAdvertisement(progressPercentage, averageThroughput)
DispatchQueue.global(qos: .background).async { //fire and forget to boost performance
self._listener.fileDownloadProgressPercentageAndDataThroughputChangedAdvertisement(progressPercentage, averageThroughput)
}
}

//@objc dont
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,9 @@ public class IOSFileUploader: NSObject {

//@objc dont
private func logMessageAdvertisement(_ message: String, _ category: String, _ level: String) {
_listener.logMessageAdvertisement(message, category, level, _remoteFilePathSanitized)
DispatchQueue.global(qos: .background).async { //fire and forget to boost performance
self._listener.logMessageAdvertisement(message, category, level, self._remoteFilePathSanitized)
}
}

//@objc dont
Expand Down Expand Up @@ -294,10 +296,12 @@ public class IOSFileUploader: NSObject {
_ progressPercentage: Int,
_ averageThroughput: Float32
) {
_listener.fileUploadProgressPercentageAndDataThroughputChangedAdvertisement(
progressPercentage,
averageThroughput
)
DispatchQueue.global(qos: .background).async { //fire and forget to boost performance
self._listener.fileUploadProgressPercentageAndDataThroughputChangedAdvertisement(
progressPercentage,
averageThroughput
)
}
}

private func setState(_ newState: EIOSFileUploaderState) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,9 @@ public class IOSFirmwareInstaller: NSObject {
//@objc dont

private func logMessageAdvertisement(_ message: String, _ category: String, _ level: String) {
_listener.logMessageAdvertisement(message, category, level);
DispatchQueue.global(qos: .background).async { //fire and forget to boost performance
self._listener.logMessageAdvertisement(message, category, level)
}
}

//@objc dont
Expand Down Expand Up @@ -245,7 +247,9 @@ public class IOSFirmwareInstaller: NSObject {
_ progressPercentage: Int,
_ averageThroughput: Float32
) {
_listener.firmwareUploadProgressPercentageAndDataThroughputChangedAdvertisement(progressPercentage, averageThroughput)
DispatchQueue.global(qos: .background).async { //fire and forget to boost performance
self._listener.firmwareUploadProgressPercentageAndDataThroughputChangedAdvertisement(progressPercentage, averageThroughput)
}
}

private func setState(_ newState: EIOSFirmwareInstallationState) {
Expand Down Expand Up @@ -371,9 +375,9 @@ extension IOSFirmwareInstaller: McuMgrLogDelegate {
atLevel level: iOSMcuManagerLibrary.McuMgrLogLevel
) {
logMessageAdvertisement(
msg,
category.rawValue,
level.name
msg,
category.rawValue,
level.name
)
}
}

0 comments on commit ca8a335

Please sign in to comment.