@@ -54,6 +54,11 @@ use tokio::{
5454
5555pub ( crate ) type SharedCell < T > = Arc < StdMutex < T > > ;
5656
57+ #[ cfg( not( feature = "web" ) ) ]
58+ type SharedAsyncCell < T > = Arc < TokioMutex < T > > ;
59+ #[ cfg( feature = "web" ) ]
60+ type SharedAsyncCell < T > = SharedCell < T > ;
61+
5762/// Implementation of `DbConnection`, `EventContext`,
5863/// and anything else that provides access to the database connection.
5964///
@@ -74,10 +79,7 @@ pub struct DbContextImpl<M: SpacetimeModule> {
7479
7580 /// Receiver channel for WebSocket messages,
7681 /// which are pre-parsed in the background by [`parse_loop`].
77- #[ cfg( not( feature = "web" ) ) ]
78- recv : Arc < TokioMutex < mpsc:: UnboundedReceiver < ParsedMessage < M > > > > ,
79- #[ cfg( feature = "web" ) ]
80- recv : SharedCell < mpsc:: UnboundedReceiver < ParsedMessage < M > > > ,
82+ recv : SharedAsyncCell < mpsc:: UnboundedReceiver < ParsedMessage < M > > > ,
8183
8284 /// Channel into which operations which apparently mutate SDK state,
8385 /// e.g. registering callbacks, push [`PendingMutation`] messages,
@@ -87,10 +89,7 @@ pub struct DbContextImpl<M: SpacetimeModule> {
8789
8890 /// Receive end of `pending_mutations_send`,
8991 /// from which [Self::apply_pending_mutations] and friends read mutations.
90- #[ cfg( not( feature = "web" ) ) ]
91- pending_mutations_recv : Arc < TokioMutex < mpsc:: UnboundedReceiver < PendingMutation < M > > > > ,
92- #[ cfg( feature = "web" ) ]
93- pending_mutations_recv : SharedCell < mpsc:: UnboundedReceiver < PendingMutation < M > > > ,
92+ pending_mutations_recv : SharedAsyncCell < mpsc:: UnboundedReceiver < PendingMutation < M > > > ,
9493
9594 /// This connection's `Identity`.
9695 ///
0 commit comments