You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ioQueue.async(flags: .barrier): will cause performance issue as many image files are being written to disk when scrolling. (it was ioQueue.async(flags: .barrier), removed for performance reason)
p.s. Files writing is discrete - mostly won't conflict.
Issue (OK Now)
Same urls written to disk at same time: possible to fail to write - but won't crash.
OK: Cached in memory - Next time it will be downloaded again.
[Risky - OK]: if two threads are writing data to the same temporary file - won't damage but data isn't corrent?
The reason to abandon .barrier flag: it blocks other operations if any writing is on going. (Files writing is discrete: mostly won't conflict) [Won't Fix] It won't cause issues:
As data.write(to:) is called with .atomic option, which won't write the target file with temp file if writing fails.
If writing fails, the downloader will download the file again as it doesn't find file in mem / disk cache.
Parent Ticket: #35
Description
In
CZDiskCacheManager.setCacheFile()
,ioQueue.async(flags: .barrier)
: will cause performance issue as many image files are being written to disk when scrolling. (it was ioQueue.async(flags: .barrier), removed for performance reason)p.s. Files writing is discrete - mostly won't conflict.
Issue (OK Now)
data.write(to: fileURL, options: [.atomic])
: atomic - won't Crash.Solutions - [Won't Fix]
[Risky - OK]: if two threads are writing data to the same temporary file - won't damage but data isn't corrent?
The reason to abandon
.barrier
flag: it blocks other operations if any writing is on going. (Files writing is discrete: mostly won't conflict)[Won't Fix] It won't cause issues:
atomic: An option to write data to an auxiliary file first and then replace the original file with the auxiliary file when the write completes.
https://developer.apple.com/documentation/foundation/nsdata/writingoptions/1411764-atomic
ioQueue.async(flags: .barrier)
back: FPS test [Cleaner: same - .atomic write]writingFiles
Set: skip if file is being writtenRelated ticket
Crash caused by thread safety - #37
The text was updated successfully, but these errors were encountered: