Вопрос

I wrote a simple Wai-to-uwsgi proxy, but in doing so, I had to use unwrapResumable. That gives an unwrapped Pipe and a "release" function that needs to be called eventually. The release function's type is ResourceT IO (), and I think I want to register it with my current resource, but to do that I'd need the release to just be IO (). What should I be doing with the release function?

Это было полезно?

Решение

The release action should already be registered with your ResourceT. In proper conduit code, there are two different ways of taking care of resource cleanup:

  • Within the Pipe itself. This cleanup will be called as early as possible, but is not exception safe.
  • From ResourceT. This is exception safe, but may be delayed.

The cleanup action provided by unwrapResumable is allowing you to reclaim the "early as possible" aspect. But if you'd just be calling the cleanup outside of the ResourceT block, there's no need to worry about it anyway.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top