If import fails still save the last reported timestamp

This allows continuing a partially failed import run.
This commit is contained in:
Philipp Wolfer 2025-05-04 11:52:12 +02:00
parent 45aeeb7087
commit 1a9f9bb36c
No known key found for this signature in database
GPG key ID: 8FDF744D4919943B
3 changed files with 15 additions and 15 deletions

View file

@ -121,16 +121,7 @@ func (c *TransferCmd[E, I, R]) Transfer(exp backends.ExportProcessor[R], imp bac
resultChan := make(chan models.ImportResult)
go imp.Process(exportChan, resultChan, importProgress)
result := <-resultChan
if timestamp.After(result.LastTimestamp) {
result.LastTimestamp = timestamp
}
progress.Wait()
if result.Error != nil {
printTimestamp("Import failed, last reported timestamp was %v (%s)", result.LastTimestamp)
return result.Error
}
fmt.Println(i18n.Tr("Imported %v of %v %s into %v.",
result.ImportCount, result.TotalCount, c.entity, c.targetName))
// Update timestamp
err = c.updateTimestamp(result, timestamp)
@ -138,6 +129,13 @@ func (c *TransferCmd[E, I, R]) Transfer(exp backends.ExportProcessor[R], imp bac
return err
}
fmt.Println(i18n.Tr("Imported %v of %v %s into %v.",
result.ImportCount, result.TotalCount, c.entity, c.targetName))
if result.Error != nil {
printTimestamp("Import failed, last reported timestamp was %v (%s)", result.LastTimestamp)
return result.Error
}
// Print errors
if len(result.ImportLog) > 0 {
fmt.Println()