Hacker News new | ask | show | jobs
by lukesandberg 4829 days ago
seeing as this is node you won't need a lock (and since it is single threaded there are no cross thread visibility issues).

What you do need is a state variable that indicates if the connection is uninitialized, loading, or ready. And if it is in the loading state you need to have a list of callbacks so that concurrent requests can be added to the list.