mirror of
https://git.sr.ht/~phw/scotty
synced 2025-05-10 02:07:05 +02:00
listenbainz: fixed loves export not considering timestamp
This commit is contained in:
parent
c305b6c7e3
commit
21d757e37c
1 changed files with 1 additions and 6 deletions
|
@ -199,7 +199,7 @@ func (b *ListenBrainzApiBackend) ExportLoves(oldestTimestamp time.Time, results
|
||||||
exportChan := make(chan models.LovesResult)
|
exportChan := make(chan models.LovesResult)
|
||||||
p := models.Progress{}
|
p := models.Progress{}
|
||||||
|
|
||||||
go b.exportLoves(time.Unix(0, 0), exportChan)
|
go b.exportLoves(oldestTimestamp, exportChan)
|
||||||
for existingLoves := range exportChan {
|
for existingLoves := range exportChan {
|
||||||
if existingLoves.Error != nil {
|
if existingLoves.Error != nil {
|
||||||
progress <- p.Complete()
|
progress <- p.Complete()
|
||||||
|
@ -219,7 +219,6 @@ func (b *ListenBrainzApiBackend) exportLoves(oldestTimestamp time.Time, results
|
||||||
offset := 0
|
offset := 0
|
||||||
defer close(results)
|
defer close(results)
|
||||||
loves := make(models.LovesList, 0, 2*MaxItemsPerGet)
|
loves := make(models.LovesList, 0, 2*MaxItemsPerGet)
|
||||||
p := models.Progress{}
|
|
||||||
|
|
||||||
out:
|
out:
|
||||||
for {
|
for {
|
||||||
|
@ -248,15 +247,11 @@ out:
|
||||||
love := feedback.AsLove()
|
love := feedback.AsLove()
|
||||||
if love.Created.After(oldestTimestamp) {
|
if love.Created.After(oldestTimestamp) {
|
||||||
loves = append(loves, love)
|
loves = append(loves, love)
|
||||||
p.Elapsed += 1
|
|
||||||
} else {
|
} else {
|
||||||
break out
|
break out
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
p.Total = int64(result.TotalCount)
|
|
||||||
p.Elapsed += int64(count)
|
|
||||||
|
|
||||||
offset += MaxItemsPerGet
|
offset += MaxItemsPerGet
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue