Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(splunk_hec source): Flush messages (#5069)
* fix(architecture): Ensure that Pipelines are flushed Fixes #5058 #4875 introduced buffering during `Pipeline.start_send`. Events were sent to the inner sink only on when `start_send` was called again or `poll_complete` is called. A side-effect of this was that when using `Sink.send_all` and `Stream.forward`, if an error was returned on a `poll()` of the stream being sent, the previously written event would never be sent to the inner sink as `poll_complete()` was never called. futures01 `Sink.send_all`: https://docs.rs/futures/0.1.30/src/futures/sink/send_all.rs.html#59-88 futures01 `Stream.forward`: https://docs.rs/futures/0.1.30/src/futures/stream/forward.rs.html#78-110 We can see in both cases it will return early if there is an error. If the stream is not ready or is finished, then it will call `poll_complete` / `close` on the sink. We use an errorable futures01 stream for the splunk_hec source: https://github.com/timberio/vector/blob/3bd8076be4097e4e9cf903a4f32e34a8b145a339/src/sources/splunk_hec.rs#L175-L189 which meant that, if there was an error processing a single event, the previous event was never flushed downstream. This change ensures that it flushes after the request is handled to send any additional buffered events. I also implement `close` to ensure that the inner sink also has `close()` called on it. Signed-off-by: Jesse Szwedko <jesse@szwedko.me>
- Loading branch information