mirror of
https://git.sr.ht/~phw/scotty
synced 2025-05-10 02:07:05 +02:00
Close export results channel in generic implementation
This removes the need for every implementation to handle this case.
This commit is contained in:
parent
16245e495d
commit
5fb1596d61
11 changed files with 5 additions and 32 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright © 2023 Philipp Wolfer <phw@uploadedlobster.com>
|
||||
Copyright © 2023-2025 Philipp Wolfer <phw@uploadedlobster.com>
|
||||
|
||||
Scotty is free software: you can redistribute it and/or modify it under the
|
||||
terms of the GNU General Public License as published by the Free Software
|
||||
|
@ -35,8 +35,9 @@ func (p ListensExportProcessor) ExportBackend() models.Backend {
|
|||
}
|
||||
|
||||
func (p ListensExportProcessor) Process(oldestTimestamp time.Time, results chan models.ListensResult, progress chan models.Progress) {
|
||||
defer close(results)
|
||||
defer close(progress)
|
||||
p.Backend.ExportListens(oldestTimestamp, results, progress)
|
||||
close(progress)
|
||||
}
|
||||
|
||||
type LovesExportProcessor struct {
|
||||
|
@ -48,6 +49,7 @@ func (p LovesExportProcessor) ExportBackend() models.Backend {
|
|||
}
|
||||
|
||||
func (p LovesExportProcessor) Process(oldestTimestamp time.Time, results chan models.LovesResult, progress chan models.Progress) {
|
||||
defer close(results)
|
||||
defer close(progress)
|
||||
p.Backend.ExportLoves(oldestTimestamp, results, progress)
|
||||
close(progress)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue