Hi!
Is there an exactor version for genstage? I feel like Iโm duplicating my code across different processes just wondering if there is an easier way to simplify?
Thanks!
Hi!
Is there an exactor version for genstage? I feel like Iโm duplicating my code across different processes just wondering if there is an easier way to simplify?
Thanks!
Avoiding code duplication is definitely a good thing, but Iโm not personally a big fan of the approach taken by ExActor. I think the macros end up producing a bit too much magic in my view. If you post some of the code that youโre trying to refactor we could perhaps offer some suggestions?
Hi!
Sorry for the late reply, got caught up with other things.
Here is some of my code:
def start_link(init \\ {}) do
GenStage.start_link(__MODULE__, init, name: __MODULE__)
end
# Callbacks
def init(_state) do
schedule_work()
{:producer, 0}
end
defp schedule_work() do
Process.send_after(self(), {:work}, 60 * 1000)
end
def handle_info({:work}, state) do
<generate data>
end
then I feel like I have to copy and paste the whole thing if I want to have a different ````` part so I thought of ExActor would simplify it.
Thanks! =)