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
- gen_server:cast(?SERVER, {spawn_cell, UserId, WorldId}),
- timer:sleep(?WAIT_TIMEOUT),
- pick_cell(UserId, WorldId, 0)
- catch
- exit:{timeout, _} -> {error, not_found}
- end
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement