After reading some code on Github, it looks like I misunderstood how the highWaterMark
concept highWaterMark
.
In the case of a recordable stream that would record a large amount of data as quickly as possible, here is an idea I had in the life cycle:
1) Until the highWaterMark
limit is reached, the stream is able to buffer and write data.
2) If the highWaterMark
limit highWaterMark
reached, the stream can no longer buffer, so the #write method returns false, so you know that what you tried to write will not write (never).
3) As soon as the thread emits a drain
event, it means that the buffer has been cleared and you can write again from where you got "rejected".
It was clear and simple in my opinion, but it seems that it is not so (in step 2), is the data you are trying to write really “rejected” when the #write method returns false? Or is it buffered (or something else)?
Sorry for the basic question, but I have to be sure!
source share