Closed laszlof closed 5 months ago
Thanks for taking a look at the implementation of DigestUtils!
If we have to take care of those streams, I think it'd be fine to open the stream per each put file operation as you did before, but we should just wrap it within Kotlin's .use {}
function that you've used before for copying the data to temp file. Thanks to that, we'll open just one stream at the time, and we will guarantee that no matter what, it'll always be closed - because currently, if any of those [...].inputStream()
would fail, you can still leave a few open streams.
We have to be extremly careful with these open streams on files, because there's actually a hard limit of open files at OS level 😅
Thanks for taking a look at the implementation of DigestUtils!
If we have to take care of those streams, I think it'd be fine to open the stream per each put file operation as you did before, but we should just wrap it within Kotlin's
.use {}
function that you've used before for copying the data to temp file. Thanks to that, we'll open just one stream at the time, and we will guarantee that no matter what, it'll always be closed - because currently, if any of those[...].inputStream()
would fail, you can still leave a few open streams.We have to be extremly careful with these open streams on files, because there's actually a hard limit of open files at OS level 😅
Does anything depend on the return of the writeFileChecksums
function?
If writeFileChecksums
succeeds, it returns Unit
(pretty much similar use-case to void
in Java), so not really. It only carries the error if anything wrong happens.
@dzikoysk PR updated. Let me know how it looks.
Thanks! I'll be releasing the next version, so I decided to push some extra changes to speed up the process :) During CR I've come up with an idea to replace these manual checksum writes with an enum + added a test to actually check if the stored content matches the output.
This approach seems a lot better/cleaner to me. Removes a lot of the duplicated code that was introduced.
Thanks for help! The new release should be available within 1-2 hours :)
Fixes #2113