Skip to content

Commit

Permalink
Merge pull request #945 from TortugaPower/942-hardlinks-rename
Browse files Browse the repository at this point in the history
Fix upload-queued jobs being terminated suddenly
  • Loading branch information
GianniCarlo committed Jun 29, 2023
2 parents 55216e3 + 1e7542b commit a8990e8
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions Shared/Services/Sync/SyncJobScheduler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,6 @@ public class SyncJobScheduler: JobSchedulerProtocol, BPLogger {
}

private func createHardLink(for item: SyncableItem) {
/// Hard links only apply to files and not folders
guard item.type == .book else { return }

let hardLinkURL = FileManager.default.temporaryDirectory.appendingPathComponent(item.relativePath)

let fileURL = DataManager.getProcessedFolderURL().appendingPathComponent(item.relativePath)
Expand All @@ -102,6 +99,7 @@ public class SyncJobScheduler: JobSchedulerProtocol, BPLogger {
try? FileManager.default.removeItem(at: hardLinkURL)
}

/// Don't throw and let the rest of the items queue up
try? FileManager.default.linkItem(at: fileURL, to: hardLinkURL)
}

Expand Down

0 comments on commit a8990e8

Please sign in to comment.