erlang - Wait for Node.connect before using :global.whereis_name -
i have following function:
def join(id) if node.connect(:"#{id}@127.0.0.1") send :global.whereis_name(id), {:join, id} end end i receive error:
(argumenterror) argument error :erlang.send(:undefined, ... which assume because node.connect gathering of information , when call :global.whereis_name has not finished yet. if throw in :timer.sleep(1000) sure enough don't error. there more elegant solution? repeat :global.whereis_name until successful or timeout reached.
edit:
i should mention have node registered name id.
you :global.sync() before :global.whereis_name(id)
Comments
Post a Comment