November 2022
Intermediate to advanced
294 pages
5h 58m
English
Let’s recap our scenario here. We have a node process terminated for some reason and recreated by the supervisor. We also managed to restore the state to that node process. But the process is now running with a new PID. So the process is under supervision but is outside of our process graph structure.
We need a few things to deal with this. We have to remember the old PID that it was running under before it crashed, and then with the old PID and the new PID, we can use the Graph.replace_vertex/3 function to update the process graph itself as:
| | iex> pg = Graph.replace_vertex(pg, old_pid, new_pid) |
But we don’t want to have to do this by hand. We’ll want to do this when a new process is initiated.
Read now
Unlock full access