Closed estreeper closed 4 months ago
I've also tried a separate implementation, including mostly lifting this from @stuartjohnpage's project here: https://github.com/revelrylabs/tulane_ops/blob/main/lib/tulaneops/prodops/client.ex
I did run into the same error [error] Unexpected message: {#Reference<0.2994086163.3377725445.171771>, :stream_next}
, which leads me to believe it is not related to the streaming implementation itself, but perhaps to some options we are passing to HTTPoison. I'm going to try matching the headers and options exactly and see if that makes a difference.
Note: I also tried downgrading HTTPoison all the way from version 2.2.1 to 2.0.0 and then 1.8.2, but saw the same behavior, so it doesn't seem to be something that broke in a newer version.
The issue turned out to be that HTTPoison needs the async: :once
option to be used. We don't know why exactly, but it does say that this allows passing messages one at a time. The two theories I can think of, without understandings the inner workings better, are:
HTTPoison.stream_next
has weird/undefined behavior without that option, as all messages are flushed from the mailbox
Background
Integrate support for
refine_stream
functionality in the ProdOps-SDK-Elixir to interact with the/api/v1/artifact_types/<artifact_type_slug>/artifacts/<artifact_type_id>/refine_stream
endpoint.Acceptance Criteria
Scenario: SDK supports refining artifact stream
refine_stream
function with required parameters<artifact_type_slug>
and<artifact_type_id>
/api/v1/artifact_types/<artifact_type_slug>/artifacts/<artifact_type_id>/refine_stream
endpoint[ ] And return a stream of refined artifact data for the specified artifact type, adhering to the endpoint's response format.
created by jackson.oberkirch+prodops@revelry.co using Prodops