mdedetrich commented on issue #175:
URL:
https://github.com/apache/incubator-pekko-http/issues/175#issuecomment-1580991881
> @mdedetrich shouldn't this handle failures?
>
> ```
> FileIO.fromPath(src.toPath)
> .mapMaterializedValue { f =>
> f.onComplete(_ => src.delete())
> }
> ```
>
> The `mapMaterializedValue` is working `Future[IOResult] => Unit`.
`Future#onComplete` works on `Try[IOResult]` so the `src.delete()` happens for
Success and Failure.
So there are multiple things going on here, one is the creation of the files
and the other is the storing for them.
>
> ShudownHooks
>
> * use memory (what if we have millions of files)
> * slow down the shutdown
>
> For me, shutdown hooks are nearly as bad as finalizers.
If this was a concern than I presume it would have already been raised
because as I said `deleteOnExit()` which is what was there previously also uses
shutdown hooks. I did check the source more concretely and it does appear to do
it in a more performant way, i.e. it has a single instances of a `ShutdownHook`
with a collection of files to be deleted. I will make a PR to just do the
`dest.toFile.deleteOnExit`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]