mirror of
https://git.sr.ht/~phw/scotty
synced 2025-06-05 12:58:33 +02:00
Simplify context cancellation checks
This commit is contained in:
parent
4a66e3d432
commit
20853f7601
5 changed files with 53 additions and 68 deletions
|
@ -90,13 +90,11 @@ func (b *SpotifyHistoryBackend) ExportListens(ctx context.Context, oldestTimesta
|
|||
fileCount := int64(len(files))
|
||||
p.Export.Total = fileCount
|
||||
for i, filePath := range files {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
results <- models.ListensResult{Error: ctx.Err()}
|
||||
if err := ctx.Err(); err != nil {
|
||||
results <- models.ListensResult{Error: err}
|
||||
p.Export.Abort()
|
||||
progress <- p
|
||||
return
|
||||
default:
|
||||
}
|
||||
|
||||
history, err := readHistoryFile(filePath)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue