File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
packages/common/src/client/sync/stream Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -191,7 +191,9 @@ export abstract class AbstractStreamingSyncImplementation
191
191
protected abortController : AbortController | null ;
192
192
protected crudUpdateListener ?: ( ) => void ;
193
193
protected streamingSyncPromise ?: Promise < void > ;
194
+
194
195
private pendingCrudUpload ?: Promise < void > ;
196
+ private notifyCompletedUploads ?: ( ) => void ;
195
197
196
198
syncStatus : SyncStatus ;
197
199
triggerCrudUpload : ( ) => void ;
@@ -217,6 +219,7 @@ export abstract class AbstractStreamingSyncImplementation
217
219
}
218
220
219
221
this . pendingCrudUpload = new Promise ( ( resolve ) => {
222
+ this . notifyCompletedUploads ?.( ) ;
220
223
this . _uploadAllCrud ( ) . finally ( ( ) => {
221
224
this . pendingCrudUpload = undefined ;
222
225
resolve ( ) ;
@@ -798,7 +801,7 @@ The next upload iteration will be delayed.`);
798
801
}
799
802
800
803
async function stop ( ) {
801
- control ( 'stop' ) ;
804
+ await control ( 'stop' ) ;
802
805
}
803
806
804
807
async function control ( op : string , payload ?: ArrayBuffer | string ) {
@@ -876,9 +879,14 @@ The next upload iteration will be delayed.`);
876
879
}
877
880
878
881
try {
882
+ this . notifyCompletedUploads = ( ) => {
883
+ control ( 'completed_upload' ) ;
884
+ } ;
885
+
879
886
await control ( 'start' , JSON . stringify ( resolvedOptions . params ) ) ;
880
887
await receivingLines ;
881
888
} finally {
889
+ this . notifyCompletedUploads = undefined ;
882
890
await stop ( ) ;
883
891
}
884
892
}
You can’t perform that action at this time.
0 commit comments