Why does NimblePool have only ! function for checkout and will exit the process calling checkout!/4

The context is that:

  • I’m using NimblePool to mange some python workers via erlang port.
  • When the python program is being initialized it can’t handle commands, so the checkouts will always timeout.

My question about that is:
Why there is no API returning {:ok, data} and {:error, :timeout}? Instead it is a API exit the process when timeout.

My guess is that, this is a design pattern in erlang?

  • If process A is going to receive from B, and for some reason B doesn’t know A got a timeout (in this case, B is a Port)
  • Process A should exit, two benefits:
    • You shouldn’t code A to handle random messages which could be outdated or mis-ordered.
    • B won’t mistake to think A receive the message successfully, because A is no longer available (in my case, a broken pipe exception in Python)
1 Like