perf: open files lazily when serving content
What does this MR do?
Avoid opening/closing the file when serving content if not necessary (for example, during an HEAD request, when using conditional requests, or ETag headers).
This should avoid sending requests to the data offset cache or creating readers, improving performance and reducing memory consumption.
TODO
-
I added the Changelogtrailer (e.g.Changelog: added) to the commits that need to be included in the changelog -
I added unit tests or they are not required -
I added acceptance tests or they are not required -
I added documentation (or it's not required) -
I followed code review guidelines -
I followed Go Style guidelines