Skip to content

Commit

Permalink
Adding comment for max loops
Browse files Browse the repository at this point in the history
  • Loading branch information
willvedd committed Feb 10, 2023
1 parent 08ab2b6 commit a5940f6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internal/keyring/keyring.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,11 @@ func GetAccessToken(tenant string) (string, error) {

var accessToken string

for i := 0; i < 10; i++ {
//Access tokens have no size limit, but should be smaller than (10*2048) bytes.
//The max number of loops safeguards against infinite loops, however unlikely.
maxNumberOfLoops := 10

for i := 0; i < maxNumberOfLoops; i++ {
a, err := keyring.Get(fmt.Sprintf("%s %d", secretAccessToken, i), tenant)
if err == keyring.ErrNotFound {
return accessToken, nil
Expand Down

0 comments on commit a5940f6

Please sign in to comment.