Promises and resolving them

The interaction pattern you may looking for:

GenServer A       GenServer B

call/3 -------> handle_call/3 # A requests work from B
  <----------------------     # B acknowledges request to A in return message (result value of call/3)

handle_cast/2 <------- cast/2 # B casts result of work back to A
                              # A processes result in handle_cast

i.e. processes typically don’t “wait” for something to happen - instead they process messages as they arrive and just don’t do anything when there aren’t any messages to process.

Also have a look at this topic:

1 Like