Skip to content

Commit

Permalink
avoid race condition
Browse files Browse the repository at this point in the history
  • Loading branch information
sonroyaalmerol committed Mar 2, 2024
1 parent bb0ece2 commit 8a532ae
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ func updateSources(ctx context.Context) {
log.Printf("Background process: Fetching M3U_URL_%d...\n", index)
wg.Add(1)
// Start the goroutine for periodic updates
go func() {
go func(nextDb *sql.DB, m3uUrl string, index int, maxConcurrency int) {
defer wg.Done()
updateSource(nextDb, m3uUrl, index, maxConcurrency)
}()
}(nextDb, m3uUrl, index, maxConcurrency)

index++
}
Expand Down

0 comments on commit 8a532ae

Please sign in to comment.