@@ -160,17 +160,14 @@ func runLoadTest(ctx context.Context, cmd *cobra.Command, args []string) error {
160160 }
161161
162162 // Create shared rate limiter for all workers if TPS is specified
163- var sharedLimiter * rate.Limiter
163+ sharedLimiter := rate .NewLimiter ( rate . Inf , 1 ) // no limit by default
164164 if settings .TPS > 0 {
165165 sharedLimiter = rate .NewLimiter (rate .Limit (settings .TPS ), 1 )
166166 log .Printf ("📈 Rate limiting enabled: %.2f TPS shared across all workers" , settings .TPS )
167- } else {
168- // No rate limiting
169- sharedLimiter = rate .NewLimiter (rate .Inf , 1 )
170167 }
171168
172169 // Create the sender from the config struct
173- snd , err := sender .NewShardedSender (cfg , settings .BufferSize , settings .Workers , sharedLimiter )
170+ snd , err := sender .NewShardedSender (cfg , settings .BufferSize , settings .Workers )
174171 if err != nil {
175172 return fmt .Errorf ("failed to create sender: %w" , err )
176173 }
@@ -240,7 +237,7 @@ func runLoadTest(ctx context.Context, cmd *cobra.Command, args []string) error {
240237 }
241238
242239 // Start the sender (starts all workers)
243- s .SpawnBgNamed ("sender" , func () error { return snd .Run (ctx ) })
240+ s .SpawnBgNamed ("sender" , func () error { return snd .Run (ctx , sharedLimiter ) })
244241 log .Printf ("✅ Connected to %d endpoints" , snd .GetNumShards ())
245242
246243 // Perform prewarming if enabled (before starting logger to avoid logging prewarm transactions)
0 commit comments