Skip to content

Commit 4f73f9a

Browse files
committed
WIP
1 parent 2347529 commit 4f73f9a

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

Sources/Swift/Integrations/SessionReplay/SentryOnDemandReplay.swift

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -109,16 +109,18 @@ class SentryOnDemandReplay: NSObject, SentryReplayVideoMaker {
109109

110110
func releaseFramesUntil(_ date: Date) {
111111
SentryLog.debug("[Session Replay] Releasing frames until date: \(date)")
112-
while let first = self._frames.first, first.time < date {
113-
self._frames.removeFirst()
114-
let fileUrl = URL(fileURLWithPath: first.imagePath)
115-
do {
116-
try FileManager.default.removeItem(at: fileUrl)
117-
SentryLog.debug("[Session Replay] Removed frame at url: \(fileUrl.path)")
118-
} catch {
119-
SentryLog.error("[Session Replay] Failed to remove frame at: \(fileUrl.path), reason: \(error.localizedDescription), ignoring error")
112+
workingQueue.dispatchAsync ({
113+
while let first = self._frames.first, first.time < date {
114+
self._frames.removeFirst()
115+
let fileUrl = URL(fileURLWithPath: first.imagePath)
116+
do {
117+
try FileManager.default.removeItem(at: fileUrl)
118+
SentryLog.debug("[Session Replay] Removed frame at url: \(fileUrl.path)")
119+
} catch {
120+
SentryLog.error("[Session Replay] Failed to remove frame at: \(fileUrl.path), reason: \(error.localizedDescription), ignoring error")
121+
}
120122
}
121-
}
123+
})
122124
}
123125

124126
var oldestFrameDate: Date? {

0 commit comments

Comments
 (0)