Revert "jspf/scrobblerlog: return results in batches"

This reverts commit a8ce2be5d7.
This commit is contained in:
Philipp Wolfer 2025-05-23 08:52:23 +02:00
parent b7ce09041e
commit 5927f41a83
No known key found for this signature in database
GPG key ID: 8FDF744D4919943B
2 changed files with 3 additions and 21 deletions

View file

@ -30,8 +30,6 @@ import (
"go.uploadedlobster.com/scotty/pkg/scrobblerlog"
)
const batchSize = 1000
type ScrobblerLogBackend struct {
filePath string
ignoreSkipped bool
@ -154,7 +152,7 @@ func (b *ScrobblerLogBackend) ExportListens(ctx context.Context, oldestTimestamp
return
}
listens := make(models.ListensList, 0, batchSize)
listens := make(models.ListensList, 0, len(b.log.Records))
client := strings.Split(b.log.Client, " ")[0]
p.Export.Total = int64(len(b.log.Records))
for _, record := range models.IterExportProgress(b.log.Records, &p, progress) {
@ -163,11 +161,6 @@ func (b *ScrobblerLogBackend) ExportListens(ctx context.Context, oldestTimestamp
listens = append(listens, recordToListen(record, client))
p.Export.TotalItems += 1
}
if len(listens) >= batchSize {
results <- models.ListensResult{Items: listens}
listens = listens[:0]
}
}
sort.Sort(listens)