Re: [whatwg/streams] Aborting a writable stream should not abort writes in progress (#611)

> Ooh, these seem pretty bad :(. (I don't quite understand how the latter could arise, though.) Maybe we could delay .closed until the write() fulfills or rejects?

Consider

```javascript
writer.write('a').then(console.log('a')).catch(console.log('reject a'));
writer.write('b').then(console.log('b')).catch(console.log('reject b'));
writer.write('c').then(console.log('c')).catch(console.log('reject c'));
writer.ready.then(() => writer.abort());
```

Assume the underlying sink is slow.

With HWM=0 this logs
```
a
b
c
```

but with HWM=4 then it logs
```
reject b
reject c
a
```

I think in practice only the most careful people will put a .catch on write(), and so only the most careful people will see this happen. Since they are careful they will have proper tests and make sure it doesn't mess up their state machine.

Delaying .closed looks like a great idea. I will try implementing it and see how it comes out.

-- 
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/611#issuecomment-261149519

Received on Thursday, 17 November 2016 04:01:53 UTC