Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %% @doc: Find a cell to serve user, and try to spawn new if that's not found
- find_cell(UserId, WorldId) ->
- case pick_cell(UserId, WorldId, 0) of
- {ok, Pid} -> {ok, Pid};
- {error, _} ->
- try
- case gen_server:cast(?SERVER, {spawn_cell, UserId, WorldId}) of
- ok -> pick_cell(UserId, WorldId, ?WAIT_TIMEOUT), pick_cell(UserId, WorldId, ?WAIT_TIMEOUT);
- Error -> Error
- end
- catch
- exit:{timeout, _} -> {error, not_found}
- end
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement