-
Notifications
You must be signed in to change notification settings - Fork 11
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
fix: ability to upload the same file after deleting #197
base: master
Are you sure you want to change the base?
Conversation
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 whole fix seems wrong for me.
If there is a chunk conflict on feed upload, check whether the identifiers of SOC match or not, if so, the problem is there -> you shouldn't write to the same index.
f73bc81
to
fd584fa
Compare
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.
so if I understand, the problem was the writeFeedDataRaw
attempted to write on a reserved index since the next subsequent index was not calculated.
it is quite strange since it should have thrown an error because of writing on a reserved index.
maybe instead of
if (!epoch) {
epoch = new Epoch(HIGHEST_LEVEL, getUnixTimestamp())
}
this snippet should find for the latest free index instead if epoch
is not defined
src/file/file.ts
Outdated
let nextEpoch | ||
try { | ||
const feedData = await getFeedData(connection.bee, fullPath, prepareEthAddress(podWallet.address)) | ||
feedData.epoch.level = feedData.epoch.getNextLevel(feedData.epoch.time) | ||
nextEpoch = feedData.epoch | ||
// eslint-disable-next-line no-empty | ||
} catch (e) {} |
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.
maybe this snippet could be moved to writeFeedData
to ensure the feed write will happen on the next free index, wdyt?
@@ -82,5 +82,7 @@ export async function writeFeedDataRaw( | |||
const id = getId(topicHash, epoch.time, epoch.level) | |||
const socWriter = connection.bee.makeSOCWriter(privateKey) | |||
|
|||
return socWriter.upload(connection.postageBatchId, id, data) | |||
return await socWriter.upload(connection.postageBatchId, id, data, { | |||
pin: true, |
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.
why do you need pinning? we do not require this
fd584fa
to
ad5d959
Compare
Close #192