문제

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