revelrylabs / prodops_ex

The Elixir SDK for ProdOps
MIT License
0 stars 0 forks source link

Engineer - ProdOps-SDK - Refine Stream Artifact Support #15

Closed estreeper closed 4 months ago

estreeper commented 4 months ago

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

estreeper commented 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.

estreeper commented 4 months ago

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: