Skip to content

Commit

Permalink
directory watcher remove dead timer code
Browse files Browse the repository at this point in the history
Signed-off-by: Joseph Mattiello <[email protected]>
  • Loading branch information
JoeMatt committed Nov 15, 2024
1 parent ecf3316 commit b2d1bec
Showing 1 changed file with 1 addition and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,8 @@ public extension NSNotification.Name {
static let PVArchiveInflationFailed = NSNotification.Name("PVArchiveInflationFailedNotification")
}

let TIMER_DELAY_IN_SECONDS = 2.0
import Perception



/// A class that watches a directory for changes and handles file operations
///
/// The DirectoryWatcher monitors a specified directory for new files and changes,
Expand Down Expand Up @@ -655,7 +652,6 @@ private actor FileWatcherManager {
var watcher: DispatchSourceFileSystemObject
var size: Int64
var modificationDate: Date
var timer: Timer?

mutating func update(size: Int64? = nil,
modificationDate: Date? = nil,
Expand All @@ -666,10 +662,6 @@ private actor FileWatcherManager {
if let modificationDate = modificationDate {
self.modificationDate = modificationDate
}
if let timer = timer {
self.timer?.invalidate()
self.timer = timer
}
}
}

Expand All @@ -687,16 +679,14 @@ private actor FileWatcherManager {
let status = FileStatus(
watcher: source,
size: initialSize,
modificationDate: modificationDate,
timer: nil
modificationDate: modificationDate
)
fileStatuses[path] = status
}

func removeWatcher(for path: URL) {
if let status = fileStatuses[path] {
status.watcher.cancel()
status.timer?.invalidate()
}
fileStatuses[path] = nil
}
Expand Down

0 comments on commit b2d1bec

Please sign in to comment.