Skip to content

Commit 0677002

Browse files
committed
Merge pull request #44 from dpatti/flush-unsets-yield
2 parents 0a2feb7 + d001dfa commit 0677002

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

lib/faraday.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ let flush_buffer t =
203203
end
204204

205205
let flush t f =
206+
t.yield <- false;
206207
flush_buffer t;
207208
if Buffers.is_empty t.scheduled then f ()
208209
else Flushes.enqueue (t.bytes_received, f) t.flushed

lib/faraday.mli

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,9 @@ val yield : t -> unit
215215
val flush : t -> (unit -> unit) -> unit
216216
(** [flush t f] registers [f] to be called when all prior writes have been
217217
successfully completed. If [t] has no pending writes, then [f] will be
218-
called immediately. *)
218+
called immediately. If {!yield} was recently called on [t], then the effect
219+
of the [yield] will be ignored so that client code has an opportunity to
220+
write pending output, regardless of how it handles [`Yield] operations. *)
219221

220222
val close : t -> unit
221223
(** [close t] closes [t]. All subsequent write calls will raise, and any

0 commit comments

Comments
 (0)