Open mpope9 opened 4 years ago
Oh I just read the Architecture
section. I still think this is a good option, the PeerDownloader isn't really supervising the Tasks, it just dispatches them if I am understanding this correctly.
Did some reworking here this evening, there's now a proper supervision tree. The PeerDownloaders do not yet launch their Tasks under a supervisor, so maybe I can go further, but I've yet to see a time a Task crashes under the latest implementation.
Matt
On Sat, 25 Jan 2020 at 23:51, Matthew Pope notifications@github.com wrote:
Oh I just read the Architecture section. I still think this is a good option, the PeerDownloader isn't really supervising the Tasks, it just dispatches them if I am understanding this correctly.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/bessey/bt-elixir/issues/1?email_source=notifications&email_token=AAFM42DTSHNQ4HD755S24ILQ7TGBPA5CNFSM4KLTSLR2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJ5IGWQ#issuecomment-578454362, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFM42BGQ6QKVM2NHOSQAXDQ7TGBPANCNFSM4KLTSLRQ .
A bit minor, but I see the PeerDownloader just uses
Task.async
to spawn a new Task. I think a supervisor added to the top level supervision tree would be useful in restarting a peer in case of a network drop? https://hexdocs.pm/elixir/Task.html#module-dynamically-supervised-tasksEasy to dynamically add a task:
Task.Supervisor.async(Bittorent.PeerSupervisor, your_function/1)