- From: Adam Rice <notifications@github.com>
- Date: Fri, 14 Apr 2017 00:51:29 -0700
- To: whatwg/streams <streams@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Friday, 14 April 2017 07:52:03 UTC
This was raised by @tyoshino in https://github.com/w3c/web-platform-tests/pull/5421#discussion_r111348353 Consider the following sink: ```javascript new WritableStream({ write(chunk) { return handle.write(chunk) .catch(reason => { cleanup(); return Promise.reject(reason); }); } close() { handle.flush(); cleanup(); } abort() { cleanup(); } cleanup() { handle.close(); } }); ``` The author is trying to be diligent in closing the handle whatever happens. But since #721 if writer.abort() is called and then sink.write() fails, cleanup() will be called twice. My feeling is that while this is unfortunate, the principle that sink.abort() is always called if writer.abort() is called before any other errors on the stream is a good one. I think adding finally() (#636) in V2 will provide a better way to implement the above sink, and until then we don't need to take any action. I opened this issue to gather other opinions and to track this problem. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/whatwg/streams/issues/735
Received on Friday, 14 April 2017 07:52:03 UTC