Skip to content

Commit

Permalink
[2.5.1] adds a throttle for known "File already exists (for moving)."…
Browse files Browse the repository at this point in the history
… sentry warning.

presumably the bug is related to #63
  • Loading branch information
biblicabeebli committed May 2, 2024
1 parent 73fc2e1 commit afef7eb
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Beiwe/Managers/DataStorageManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import IDZSwiftCommonCrypto
import Security
import Sentry

var FILE_WRITE_FILE_EXISTS_COUNTER = 0

enum DataStorageErrors: Error {
case cantCreateFile
case notInitialized
Expand Down Expand Up @@ -298,7 +300,11 @@ class DataStorageManager {
sentry_warning("File not found (for moving).", shortenPath(src), crash:false)
} catch CocoaError.fileWriteFileExists {
// print("File already exists (for moving) \(shortenPath(dst)), giving up for now because that's crazy?")
sentry_warning("File already exists (for moving).", shortenPath(dst), crash:false)
// we are getting a huge number of these reported, so throttle by 10x?
FILE_WRITE_FILE_EXISTS_COUNTER += 1
if FILE_WRITE_FILE_EXISTS_COUNTER % 10 == 0 {
sentry_warning("File already exists (for moving).", shortenPath(dst), crash:false)
}
} catch CocoaError.fileWriteOutOfSpace {
// print("Out of space (for moving) \(shortenPath(dst))")
// sentry_warning("Out of space (for moving).", shortenPath(dst)) // never report out of space like this.
Expand Down

0 comments on commit afef7eb

Please sign in to comment.