How to run stream after viewing response page?

I have successfully parsed CSV file, inserted all entries into DB, got all conflicted entries…
But, what I am thinking of, is to update user progressively while each async stream task finishes its work.

Here is a diagram that illustrate what I am thinking of:

In the docs of Stream:

No computation will be done until we call one of the Enum functions or Stream.run/1

If I can run the stream after rendering the html result page, I think that would solve my problem, is this possible to reference the used Stream and run it later? (after finishing the method created in, ex: def create(conn, %{"csvs" => csvs_params}) do using Registry maybe?

1 Like

In short, how do I store a reference for stream and invoke it from client through channel message? any idea?

1 Like