mirror of
https://git.sr.ht/~phw/scotty
synced 2025-04-16 10:09:28 +02:00
Close export progress in export goroutine
Fixes crash in case of importer exiting prematurely
This commit is contained in:
parent
1cea9bd301
commit
84443d0e69
3 changed files with 3 additions and 1 deletions
|
@ -9,6 +9,7 @@
|
||||||
history JSON files
|
history JSON files
|
||||||
- Allow date time string for `--timestamp` parameter
|
- Allow date time string for `--timestamp` parameter
|
||||||
- Fixed completed progress bar showing empty
|
- Fixed completed progress bar showing empty
|
||||||
|
- Fixed crash in case of importer returning an error on import start
|
||||||
|
|
||||||
|
|
||||||
## 0.3.1 - 2023-12-10
|
## 0.3.1 - 2023-12-10
|
||||||
|
|
|
@ -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) {
|
func (p ListensExportProcessor) Process(oldestTimestamp time.Time, results chan models.ListensResult, progress chan models.Progress) {
|
||||||
p.Backend.ExportListens(oldestTimestamp, results, progress)
|
p.Backend.ExportListens(oldestTimestamp, results, progress)
|
||||||
|
close(progress)
|
||||||
}
|
}
|
||||||
|
|
||||||
type LovesExportProcessor struct {
|
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) {
|
func (p LovesExportProcessor) Process(oldestTimestamp time.Time, results chan models.LovesResult, progress chan models.Progress) {
|
||||||
p.Backend.ExportLoves(oldestTimestamp, results, progress)
|
p.Backend.ExportLoves(oldestTimestamp, results, progress)
|
||||||
|
close(progress)
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,7 +126,6 @@ func (c *TransferCmd[E, I, R]) Transfer(exp backends.ExportProcessor[R], imp bac
|
||||||
if result.LastTimestamp.Unix() < timestamp.Unix() {
|
if result.LastTimestamp.Unix() < timestamp.Unix() {
|
||||||
result.LastTimestamp = timestamp
|
result.LastTimestamp = timestamp
|
||||||
}
|
}
|
||||||
close(exportProgress)
|
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
progress.Wait()
|
progress.Wait()
|
||||||
if result.Error != nil {
|
if result.Error != nil {
|
||||||
|
|
Loading…
Add table
Reference in a new issue