mirror of
https://github.com/gravitational/teleport.git
synced 2026-09-21 14:12:20 +08:00
Modernize lib/auth and lib/utils (#55976)
This commit is contained in:
@@ -18,7 +18,6 @@
|
||||
package sortcache
|
||||
|
||||
import (
|
||||
"context"
|
||||
"slices"
|
||||
"strconv"
|
||||
"testing"
|
||||
@@ -319,7 +318,7 @@ func BenchmarkSortCache(b *testing.B) {
|
||||
cache.Put(r2)
|
||||
|
||||
// seed cache with lots of additional resources to help simulate large reads
|
||||
for i := 0; i < resourcesPerKind-1; i++ {
|
||||
for i := range resourcesPerKind - 1 {
|
||||
cache.Put(resource{
|
||||
kind: "node",
|
||||
name: strconv.Itoa(i),
|
||||
@@ -333,8 +332,7 @@ func BenchmarkSortCache(b *testing.B) {
|
||||
// set up a background process to inject concurrent writes in a fairly
|
||||
// tight loop (should roughly simulate the load generated by a background
|
||||
// event stream injecting updates into a replica).
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
ctx := b.Context()
|
||||
go func() {
|
||||
for {
|
||||
if ctx.Err() != nil {
|
||||
@@ -346,7 +344,7 @@ func BenchmarkSortCache(b *testing.B) {
|
||||
}()
|
||||
|
||||
// set up a bunch of background concurrent read operations to simulate load.
|
||||
for i := 0; i < concurrency; i++ {
|
||||
for range concurrency {
|
||||
go func() {
|
||||
var n int
|
||||
buf := make([]resource, 0, resourcesPerKind)
|
||||
|
||||
Reference in New Issue
Block a user