File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ pub struct Database {
33
33
#[ cfg( feature = "replication" ) ]
34
34
pub replication_ctx : Option < ReplicationContext > ,
35
35
#[ cfg( feature = "sync" ) ]
36
- pub sync_ctx : Option < SyncContext > ,
36
+ pub sync_ctx : Option < tokio :: sync :: Mutex < SyncContext > > ,
37
37
}
38
38
39
39
impl Database {
@@ -143,7 +143,10 @@ impl Database {
143
143
endpoint
144
144
} ;
145
145
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
+ ) ) ) ;
147
150
Ok ( db)
148
151
}
149
152
@@ -383,7 +386,7 @@ impl Database {
383
386
#[ cfg( feature = "sync" ) ]
384
387
/// Push WAL frames to remote.
385
388
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 ;
387
390
let conn = self . connect ( ) ?;
388
391
389
392
let page_size = {
You can’t perform that action at this time.
0 commit comments