-
Notifications
You must be signed in to change notification settings - Fork 268
await on join #2137
await on join #2137
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏 👏 👏
crates/sim2h/src/sim2h_im_state.rs
Outdated
let f = self.new_connection(space_hash, agent_id, uri); | ||
tokio::task::spawn(f); | ||
f.await |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My intention was that functions prefixed with spawn_
would not return futures (or anything else) because they spawn the task.
If we don't need this, we can just delete this whole function - and lib.rs can call new_connection()
directly : )
crates/sim2h/src/lib.rs
Outdated
@@ -522,17 +531,20 @@ fn spawn_handle_message_hello( | |||
} | |||
} | |||
|
|||
fn spawn_handle_message_join_space( | |||
async fn spawn_handle_message_join_space( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
similarly, remove the spawn_
prefix here if that's not what we're doing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
couple cosmetic name change suggestions - but this looks awesome : )
Nice find! 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved with the naming changes so that we keep functions consistently named to intent. WOOT!
Co-Authored-By: Connor Turland <connorturland@gmail.com>
PR summary
This awaits on the new connection future instead of just spawning it because otherwise the
Lib3hToClient::HandleGetGossipingEntryList
andLib3hToClient::HandleGetAuthoringEntryList
messages get sent and can be responded to before the join is complete. This leads to the responses to those messages being thrown away. Then the agents id's never actually get into the DHT.testing/benchmarking notes
( if any manual testing or benchmarking was/should be done, add notes and/or screenshots here )
followups
( any new tickets/concerns that were discovered or created during this work but aren't in scope for review here )
changelog
documentation