Skip to content

Commit

Permalink
chore: potential race fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Vilsol committed Dec 21, 2023
1 parent ad5ef75 commit db1efc9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cli/installations.go
Original file line number Diff line number Diff line change
Expand Up @@ -536,11 +536,14 @@ func (i *Installation) UpdateMods(ctx *GlobalContext, mods []string) error {
func downloadAndExtractMod(modReference string, version string, link string, hash string, modsDirectory string, updates chan<- InstallUpdate, downloadSemaphore chan int, d disk.Disk) error {
var downloadUpdates chan utils.GenericProgress

var wg sync.WaitGroup
if updates != nil {
// Forward the inner updates as InstallUpdates
downloadUpdates = make(chan utils.GenericProgress)

wg.Add(1)
go func() {
defer wg.Done()
for up := range downloadUpdates {
updates <- InstallUpdate{
Item: InstallUpdateItem{
Expand All @@ -564,7 +567,6 @@ func downloadAndExtractMod(modReference string, version string, link string, has

var extractUpdates chan utils.GenericProgress

var wg sync.WaitGroup
if updates != nil {
// Forward the inner updates as InstallUpdates
extractUpdates = make(chan utils.GenericProgress)
Expand Down

0 comments on commit db1efc9

Please sign in to comment.