Skip to content
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: close file on readAll exception #682

Merged
merged 1 commit into from
Nov 22, 2024

Conversation

dsherret
Copy link
Contributor

The file would remain open on a readAll exception.

if (stats.size < maxbuffer) {
const buffer = await readAll(file);
file.close();
const buffer = await Deno.readFile(path);
Copy link
Contributor Author

@dsherret dsherret Nov 22, 2024

Choose a reason for hiding this comment

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

Instead of handling closing the file on readAll, we can just use the readFile api directly and remove the readAll dependency (I think the code should also work faster or have the potential to be faster by doing this too)

Copy link
Collaborator

@kitsonk kitsonk left a comment

Choose a reason for hiding this comment

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

LGTM

@kitsonk kitsonk merged commit 13f0295 into oakserver:main Nov 22, 2024
5 checks passed
@dsherret dsherret deleted the fix_close_file_on_read_exception branch November 22, 2024 20:34
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.

2 participants