-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Plug edgecase for finding existing files #33
Conversation
This reverts commit 03abe75. This was committed mistakenly, with a misunderstanding how findExist is used. findExist does correctly verify its content. There's no reason to tell the user only a hash is used.
This has a bug I've fixed locally. I'll reopen when it's tested. |
Bug fixed. Should be good to merge. |
fdcbc08
to
0c0cf28
Compare
Well, I see. However, this will change the return of |
Cache.saveFileRecord(sha1, records) | ||
return matchTX | ||
return matchTXs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return matchTXs[0]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue with returning one TX is that if it is not the one used by the most recent D record, it will never match.
logic.js
Outdated
@@ -123,16 +123,19 @@ async function reduceFileDatum (fileDatum, address) { | |||
API.log(`[+] Checking Exist Record`, API.logLevel.INFO) | |||
for (var fileData of fileDatum) { | |||
API.log(` - Checking ${fileData.dKey}`, API.logLevel.INFO) | |||
var fileTX = await API.findExist(fileData.buf, fileData.mime) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then we don't need to change this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is changed so that all TX ids can be compared, when looking for D records. Not doing that is producing the edge cases that result in uploading repeatedly forever. But I see I failed to make the same change to findD, leaving more edge cases. I'll close this PR and reopen it when that change is made.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update: Actually, it looks good. The reason this is changed is so that all the TX ids can be compared with the most recent D record. If only one is compared, it reuploads again even if the D record has a different link with the same content. (I also had an additional bug where it would reupload forever; I haven't found that one, not sure how.)
Closing until I fix more edgecases similar to these, in findD. |
On review, the code looks good. I'll add a comment to each line comment. |
would it work better to make a |
good idea |
This changes the match detection code for D links so that when a file has been multiply uploaded due to some edge case, all uploads are compared to find the D record. Otherwise you get an issue where you keep uploading the same D records over and over and over.
This PR includes #32's fix for the rogue commit in #31.