[轉]Keep your promises when using Cloud Functions for Firebase!
const ref_p1_state = root.child(`player_states/${game_state.p1uid}`)
const ref_p2_state = root.child(`player_states/${game_state.p2uid}`)
const pr_update_p1 = ref_p1_state.update(update_p1)
const pr_update_p2 = ref_p2_state.update(update_p2)
return Promise.all([pr_update_p1, pr_update_p2])
==========
https://stackoverflow.com/questions/55430079/promise-all-does-not-wait-for-firestore-query-to-loop