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

Only read unbuffered when we read the whole file #13197

Merged
merged 1 commit into from
Jan 12, 2024
Merged

Conversation

martin-fleck-at
Copy link
Contributor

What it does

We only want to use unbuffered reading when we read the whole file, otherwise the optimization we gain through it seems to be lost.

Please note that there is a difference between readFile which returns a binary buffer and read which is used to read textual content. Furthermore, limits are applied automatically on the read method so even if you only want to read 10 characters it will fail if the file size is larger than the limit (files.maxFileSizeMB preference).

Fixes #13161

How to test

  • Open any file with the FileService and provide a specific length to read, see bug report
  • You can use https://github.com/eclipse-theia/theia/tree/issues/13161-test which simply reads a length of 10 with read and readFile using the SampleCommand2.
  • Both should work without issues, even if you choose a large enough file as I set the limit option of the read method to the highest, safe integer.

Review checklist

Reminder for reviewers

Copy link
Contributor

@tortmayr tortmayr left a comment

Choose a reason for hiding this comment

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

Changes look good to me.The Test Scenario now works as expected.

@martin-fleck-at martin-fleck-at merged commit f7e2ef9 into master Jan 12, 2024
14 checks passed
@martin-fleck-at martin-fleck-at deleted the issues/13161 branch January 12, 2024 09:44
@github-actions github-actions bot added this to the 1.46.0 milestone Jan 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
2 participants