mirror of
https://git.sr.ht/~phw/scotty
synced 2025-05-10 02:07:05 +02:00
If import fails still save the last reported timestamp
This allows continuing a partially failed import run.
This commit is contained in:
parent
45aeeb7087
commit
1a9f9bb36c
3 changed files with 15 additions and 15 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue