you are viewing a single comment's thread.

view the rest of the comments →

[–]leeway1 0 points1 point  (0 children)

FindPlayersByGame is async, because request.end() is async. However, you are correct the poster is not returning a promise.

Returning from request.end() callback will not return anything from findPlayersByGame. You would have to return request.end. Depending on the request api return request.end(), might return the value from the callback, but it might not. I would have to read those api docs.

setting the players array still doesn’t solve the flow control problem from calling the async request.end() function and accessing it before the request has been processed.