Skip to content
This repository has been archived by the owner on Feb 27, 2024. It is now read-only.

Add more logging to the V1 file uploader #245

Merged
merged 2 commits into from
Feb 16, 2024

Conversation

syoung-smallwisdom
Copy link
Collaborator

@syoung-smallwisdom syoung-smallwisdom commented Feb 16, 2024

Crashlytics is reporting that the V1 uploader is attempting to repeatedly upload an orphaned file with no attributes.

The device in question successfully uploaded the three files, but it looks like they were left behind and not deleted. I'm adding some additional logging to see if there is some pattern I can use to successfully mark the files as uploaded and delete them.

I figured out that files were being stored in the base directory of the "Application Support" directory and the uploader was counting those as orphaned files rather than skipping them.

Copy link
Contributor

@Erin-Mounts Erin-Mounts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple questions/concerns

let fullPath = self.fullyQualifiedPath(of: filePath)
guard FileManager.default.fileExists(atPath: fullPath) else {
let message = "Unexpected: Attempting to retrieve upload API info for temp file with invariant path '\(filePath) but temp file does not exist at '\(fullPath)"
throw BridgeUnexpectedNullError(category: .missingFile, message: message)
}
let tempFile = URL(fileURLWithPath: fullPath)
let attributes = try? FileManager.default.attributesOfItem(atPath: fullPath)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not 100% certain, but I don't think this gets extended attributes, if that's what you were hoping to log. There's a completely separate api for xattrs. IIRC there's a class extension somewhere that implements this since I think xattrs api is Obj-C only.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I'm looking for the attributes like "when was the file last modified/created" rather than the extended attributes.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah ok makes sense

Copy link

github-actions bot commented Feb 16, 2024

Unit Test Results

87 tests   86 ✔️  20s ⏱️
25 suites    0 💤
25 files      1

For more details on these failures, see this check.

Results for commit 609a96a.

♻️ This comment has been updated with latest results.

This was trying to process files that were being stored by the app in app support at the base directory.
@syoung-smallwisdom syoung-smallwisdom merged commit 900f37c into main Feb 16, 2024
1 of 3 checks passed
@syoung-smallwisdom syoung-smallwisdom deleted the syoung/orphan-upload-logging branch February 16, 2024 23:58
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants