File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -170,16 +170,22 @@ StreamWriter
170
170
171
171
.. method :: drain()
172
172
173
- Wait until the write buffer of the underlying transport is flushed.
173
+ Let the write buffer of the underlying transport a chance to be flushed.
174
174
175
175
The intended use is to write::
176
176
177
177
w.write(data)
178
178
yield from w.drain()
179
179
180
- When the transport buffer is full (the protocol is paused), block until
181
- the buffer is (partially) drained and the protocol is resumed. When there
182
- is nothing to wait for, the yield-from continues immediately.
180
+ When the size of the transport buffer reaches the high-water limit (the
181
+ protocol is paused), block until the size of the buffer is drained down
182
+ to the low-water limit and the protocol is resumed. When there is nothing
183
+ to wait for, the yield-from continues immediately.
184
+
185
+ Yielding from :meth: `drain ` gives the opportunity for the loop to
186
+ schedule the write operation and flush the buffer. It should especially
187
+ be used when a possibly large amount of data is written to the transport,
188
+ and the coroutine does not yield-from between calls to :meth: `write `.
183
189
184
190
This method is a :ref: `coroutine <coroutine >`.
185
191
Original file line number Diff line number Diff line change @@ -1125,6 +1125,7 @@ Francesco Ricciardi
1125
1125
Tim Rice
1126
1126
Jan Pieter Riegel
1127
1127
Armin Rigo
1128
+ Martin Richard
1128
1129
Arc Riley
1129
1130
Nicholas Riley
1130
1131
Jean-Claude Rimbault
You can’t perform that action at this time.
0 commit comments