Skip to content

Conversation

@marino39
Copy link
Contributor

No description provided.

Copy link
Contributor

@VojtechVitek VojtechVitek left a comment

Choose a reason for hiding this comment

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

LGTM

writer.go Outdated
Comment on lines 217 to 221
recoverFileIndex := func() {
// remove last file from file index as it's not written
files := w.fileIndex.Files()[:len(w.fileIndex.Files())-1]
w.fileIndex = NewFileIndexFromFiles(w.fs, files)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you could really defer it on error:

defer func () {
	if err != nil {
        // remove last file from file index as it's not written
		files := w.fileIndex.Files()[:len(w.fileIndex.Files())-1]
		w.fileIndex = NewFileIndexFromFiles(w.fs, files)
	}
}()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@marino39 marino39 merged commit b13b9d5 into master Oct 22, 2025
1 check passed
@marino39 marino39 deleted the fix-double-close-on-write-error branch October 22, 2025 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants