(b *testing.B)
| 533 | } |
| 534 | |
| 535 | func BenchmarkRingShardingRebalanceLocked(b *testing.B) { |
| 536 | opts := &RingOptions{ |
| 537 | Addrs: make(map[string]string), |
| 538 | // Disable heartbeat |
| 539 | HeartbeatFrequency: 1 * time.Hour, |
| 540 | } |
| 541 | for i := 0; i < 100; i++ { |
| 542 | opts.Addrs[fmt.Sprintf("shard%d", i)] = fmt.Sprintf(":63%02d", i) |
| 543 | } |
| 544 | |
| 545 | ring := NewRing(opts) |
| 546 | defer ring.Close() |
| 547 | |
| 548 | b.ResetTimer() |
| 549 | for i := 0; i < b.N; i++ { |
| 550 | ring.sharding.rebalanceLocked() |
| 551 | } |
| 552 | } |
| 553 | |
| 554 | type testCounter struct { |
| 555 | mu sync.Mutex |
nothing calls this directly
no test coverage detected