Closed mnaamani closed 8 months ago
Thanks for investigating and fixing the issue. Wouldn't it be much simpler to store data object ID (
req.params.id
) at the start of the bothGET
/HEAD
handlers, before thetry
block starts. This way the data object ID in thefinally
block would still be valid and we won't have to separately do the unpinning at multiple different places.
Yes that was one of the reasons I moved the data object id instantiation outside of the try
block, but then realized that I had to get rid of the finally
clause because it can be reached before the stream ends. So we would be unpinning too early, defeating the whole point.
It is easy to miss such cases when mixing async/await
code with traditional node event and steam based paradigm in the same function.
closes:
undefined
key into idCache map