Close export progress in export goroutine

Fixes crash in case of importer exiting prematurely
This commit is contained in:
Philipp Wolfer 2024-01-15 08:21:38 +01:00
parent 1cea9bd301
commit 84443d0e69
No known key found for this signature in database
GPG key ID: 8FDF744D4919943B
3 changed files with 3 additions and 1 deletions

View file

@ -9,6 +9,7 @@
history JSON files
- Allow date time string for `--timestamp` parameter
- Fixed completed progress bar showing empty
- Fixed crash in case of importer returning an error on import start
## 0.3.1 - 2023-12-10

View file

@ -36,6 +36,7 @@ func (p ListensExportProcessor) ExportBackend() models.Backend {
func (p ListensExportProcessor) Process(oldestTimestamp time.Time, results chan models.ListensResult, progress chan models.Progress) {
p.Backend.ExportListens(oldestTimestamp, results, progress)
close(progress)
}
type LovesExportProcessor struct {
@ -48,4 +49,5 @@ func (p LovesExportProcessor) ExportBackend() models.Backend {
func (p LovesExportProcessor) Process(oldestTimestamp time.Time, results chan models.LovesResult, progress chan models.Progress) {
p.Backend.ExportLoves(oldestTimestamp, results, progress)
close(progress)
}

View file

@ -126,7 +126,6 @@ func (c *TransferCmd[E, I, R]) Transfer(exp backends.ExportProcessor[R], imp bac
if result.LastTimestamp.Unix() < timestamp.Unix() {
result.LastTimestamp = timestamp
}
close(exportProgress)
wg.Wait()
progress.Wait()
if result.Error != nil {