Skip to content
This repository has been archived by the owner on Nov 12, 2023. It is now read-only.

Commit

Permalink
Fix ReloadAccounts if accounts are removed
Browse files Browse the repository at this point in the history
The logic handling the removal of accounts will skip
checking the next account whenever one is being removed
from the slice. If there's 2 in a row to remove, the
2nd one won't get removed. This fixes it.

This also removes duplicate err checking in LoadKojiAreas().
  • Loading branch information
comstud committed Oct 14, 2023
1 parent ebc041a commit 0c25760
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
7 changes: 5 additions & 2 deletions accounts/accountManager.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ import (
"flygon/config"
"flygon/db"
"flygon/pogo"
log "github.com/sirupsen/logrus"
"gopkg.in/guregu/null.v4"
"sync"
"time"

log "github.com/sirupsen/logrus"
"gopkg.in/guregu/null.v4"
)

type AccountDetails struct {
Expand Down Expand Up @@ -86,6 +87,8 @@ func (a *AccountManager) ReloadAccounts() {
a.accounts = append(a.accounts[:x], a.accounts[x+1:]...)
a.inUse = append(a.inUse[:x], a.inUse[x+1:]...)
foundRecords = append(foundRecords[:x], foundRecords[x+1:]...)
// 'x' now points to next record, so we need to repeat
x--
}
}
}
Expand Down
4 changes: 0 additions & 4 deletions koji/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,6 @@ func LoadKojiAreas(details *db.DbDetails) {
return
}

if err != nil {
log.Errorf("[KOJI]: %s", err)
return
}
var backgroundProcesses sync.WaitGroup

parallelSem := make(chan bool, 50)
Expand Down

0 comments on commit 0c25760

Please sign in to comment.