Skip to content

Commit

Permalink
Update modules/caddyhttp/caddyauth/basicauth.go
Browse files Browse the repository at this point in the history
Fix comment

Co-authored-by: Francis Lavoie <lavofr@gmail.com>
  • Loading branch information
u5surf and francislavoie committed Jan 30, 2023
1 parent 31be927 commit 7374846
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion modules/caddyhttp/caddyauth/basicauth.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,10 @@ func (hba HTTPBasicAuth) correctPassword(account Account, plaintextPassword []by
return same, nil
}
// slow track: do the expensive op, then add it to the cache
// but it occurred the thunder herd, thus it uses singleflight
// but perform it in a singleflight group so that multiple
// parallel requests using the same password don't cause a
// thundering herd problem by all performing the same hashing
// operation before the first one finishes and caches it.
v, err, _ := hba.HashCache.g.Do(cacheKey, func() (any, error) {
return compare()
})
Expand Down

0 comments on commit 7374846

Please sign in to comment.