@@ -441,16 +441,8 @@ The next upload iteration will be delayed.`);
441
441
if ( signal ?. aborted ) {
442
442
break ;
443
443
}
444
- const { retry } = await this . streamingSyncIteration ( nestedAbortController . signal , options ) ;
445
- if ( ! retry ) {
446
- /**
447
- * A sync error ocurred that we cannot recover from here.
448
- * This loop must terminate.
449
- * The nestedAbortController will close any open network requests and streams below.
450
- */
451
- break ;
452
- }
453
- // Continue immediately
444
+ await this . streamingSyncIteration ( nestedAbortController . signal , options ) ;
445
+ // Continue immediately, streamingSyncIteration will wait before completing if necessary.
454
446
} catch ( ex ) {
455
447
/**
456
448
* Either:
@@ -508,8 +500,8 @@ The next upload iteration will be delayed.`);
508
500
protected async streamingSyncIteration (
509
501
signal : AbortSignal ,
510
502
options ?: PowerSyncConnectionOptions
511
- ) : Promise < { retry ?: boolean } > {
512
- return await this . obtainLock ( {
503
+ ) : Promise < void > {
504
+ await this . obtainLock ( {
513
505
type : LockType . SYNC ,
514
506
signal,
515
507
callback : async ( ) => {
@@ -559,7 +551,7 @@ The next upload iteration will be delayed.`);
559
551
const line = await stream . read ( ) ;
560
552
if ( ! line ) {
561
553
// The stream has closed while waiting
562
- return { retry : true } ;
554
+ return ;
563
555
}
564
556
565
557
// A connection is active and messages are being received
@@ -591,7 +583,7 @@ The next upload iteration will be delayed.`);
591
583
} else if ( isStreamingSyncCheckpointComplete ( line ) ) {
592
584
const result = await this . applyCheckpoint ( targetCheckpoint ! , signal ) ;
593
585
if ( result . endIteration ) {
594
- return { retry : true } ;
586
+ return ;
595
587
} else if ( result . applied ) {
596
588
appliedCheckpoint = targetCheckpoint ;
597
589
}
@@ -604,7 +596,7 @@ The next upload iteration will be delayed.`);
604
596
// This means checksums failed. Start again with a new checkpoint.
605
597
// TODO: better back-off
606
598
await new Promise ( ( resolve ) => setTimeout ( resolve , 50 ) ) ;
607
- return { retry : true } ;
599
+ return ;
608
600
} else if ( ! result . ready ) {
609
601
// If we have pending uploads, we can't complete new checkpoints outside of priority 0.
610
602
// We'll resolve this for a complete checkpoint.
@@ -681,7 +673,7 @@ The next upload iteration will be delayed.`);
681
673
* (uses the same one), this should have some delay.
682
674
*/
683
675
await this . delayRetry ( ) ;
684
- return { retry : true } ;
676
+ return ;
685
677
}
686
678
this . triggerCrudUpload ( ) ;
687
679
} else {
@@ -699,9 +691,7 @@ The next upload iteration will be delayed.`);
699
691
} else if ( validatedCheckpoint === targetCheckpoint ) {
700
692
const result = await this . applyCheckpoint ( targetCheckpoint ! , signal ) ;
701
693
if ( result . endIteration ) {
702
- // TODO: Why is this one retry: false? That's the only change from when we receive
703
- // the line above?
704
- return { retry : false } ;
694
+ return ;
705
695
} else if ( result . applied ) {
706
696
appliedCheckpoint = targetCheckpoint ;
707
697
}
@@ -710,7 +700,7 @@ The next upload iteration will be delayed.`);
710
700
}
711
701
this . logger . debug ( 'Stream input empty' ) ;
712
702
// Connection closed. Likely due to auth issue.
713
- return { retry : true } ;
703
+ return ;
714
704
}
715
705
} ) ;
716
706
}
0 commit comments