File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ pub struct Database {
3333 #[ cfg( feature = "replication" ) ]
3434 pub replication_ctx : Option < ReplicationContext > ,
3535 #[ cfg( feature = "sync" ) ]
36- pub sync_ctx : Option < SyncContext > ,
36+ pub sync_ctx : Option < tokio :: sync :: Mutex < SyncContext > > ,
3737}
3838
3939impl Database {
@@ -143,7 +143,10 @@ impl Database {
143143 endpoint
144144 } ;
145145 let mut db = Database :: open ( & db_path, flags) ?;
146- db. sync_ctx = Some ( SyncContext :: new ( endpoint, Some ( auth_token) ) ) ;
146+ db. sync_ctx = Some ( tokio:: sync:: Mutex :: new ( SyncContext :: new (
147+ endpoint,
148+ Some ( auth_token) ,
149+ ) ) ) ;
147150 Ok ( db)
148151 }
149152
@@ -383,7 +386,7 @@ impl Database {
383386 #[ cfg( feature = "sync" ) ]
384387 /// Push WAL frames to remote.
385388 pub async fn push ( & self ) -> Result < crate :: database:: Replicated > {
386- let sync_ctx = self . sync_ctx . as_ref ( ) . unwrap ( ) ;
389+ let sync_ctx = self . sync_ctx . as_ref ( ) . unwrap ( ) . lock ( ) . await ;
387390 let conn = self . connect ( ) ?;
388391
389392 let page_size = {
You can’t perform that action at this time.
0 commit comments