Skip to content

Commit e547ddb

Browse files
committed
Address comment
1 parent 213f83a commit e547ddb

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

client/mirror/client.go

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -452,15 +452,16 @@ func (c *Client) Sync(ctx context.Context, targetCheckpointRaw []byte, targetSiz
452452
// Push the checkpoint with the old size (0 if not provided).
453453
for c.oldSize < targetSize {
454454
err := c.pushCheckpoint(ctx, c.oldSize, targetSize, targetCheckpointRaw)
455-
if err == nil {
456-
nextEntry = c.oldSize
457-
c.oldSize = targetSize
458-
break
459-
}
460-
if !errors.As(err, &conflict) {
461-
return nil, fmt.Errorf("failed to push checkpoint: %v", err)
455+
if err != nil {
456+
if !errors.As(err, &conflict) {
457+
return nil, fmt.Errorf("failed to push checkpoint: %v", err)
458+
}
459+
c.oldSize = max(c.oldSize, conflict.PendingSize)
460+
continue
462461
}
463-
c.oldSize = max(c.oldSize, conflict.PendingSize)
462+
463+
nextEntry = c.oldSize
464+
c.oldSize = targetSize
464465
}
465466

466467
// Push entries up to target size in packages of 256, handling concurrent conflicts and retries.

0 commit comments

Comments
 (0)