@@ -573,7 +573,7 @@ func Test_RateLimiting_UnderLimit(t *testing.T) {
573573 }
574574
575575 now := time .Now ()
576-
576+
577577 // Add 4 messages in the last second (under the 5/second limit)
578578 for i := 0 ; i < 4 ; i ++ {
579579 player .messageTimestamps = append (player .messageTimestamps , now .Add (- time .Duration (i * 100 )* time .Millisecond ))
@@ -590,7 +590,7 @@ func Test_RateLimiting_ExceedPerSecondLimit(t *testing.T) {
590590 }
591591
592592 now := time .Now ()
593-
593+
594594 // Add 5 messages in the last second (at the 5/second limit)
595595 for i := 0 ; i < 5 ; i ++ {
596596 player .messageTimestamps = append (player .messageTimestamps , now .Add (- time .Duration (i * 100 )* time .Millisecond ))
@@ -608,7 +608,7 @@ func Test_RateLimiting_ExceedWindowLimit(t *testing.T) {
608608 }
609609
610610 now := time .Now ()
611-
611+
612612 // Add 30 messages spread over 19 seconds (at the 30/20s limit)
613613 for i := 0 ; i < 30 ; i ++ {
614614 // Spread messages across 19 seconds, not exceeding 5/second
@@ -627,15 +627,15 @@ func Test_RateLimiting_OldTimestampsCleanup(t *testing.T) {
627627 }
628628
629629 now := time .Now ()
630-
630+
631631 // Add 30 messages older than 20 seconds
632632 for i := 0 ; i < 30 ; i ++ {
633633 player .messageTimestamps = append (player .messageTimestamps , now .Add (- 21 * time .Second ))
634634 }
635635
636636 // Should not be rate limited (all timestamps are old and should be cleaned up)
637637 require .False (t , isRateLimited (player ))
638-
638+
639639 // Verify old timestamps were cleaned up
640640 require .Equal (t , 0 , len (player .messageTimestamps ))
641641}
@@ -664,20 +664,20 @@ func Test_RateLimiting_MixedOldAndNewMessages(t *testing.T) {
664664 }
665665
666666 now := time .Now ()
667-
667+
668668 // Add 15 old messages (older than 20 seconds)
669669 for i := 0 ; i < 15 ; i ++ {
670670 player .messageTimestamps = append (player .messageTimestamps , now .Add (- 21 * time .Second ))
671671 }
672-
672+
673673 // Add 4 recent messages (under the 5/second limit)
674674 for i := 0 ; i < 4 ; i ++ {
675675 player .messageTimestamps = append (player .messageTimestamps , now .Add (- time .Duration (i * 200 )* time .Millisecond ))
676676 }
677677
678678 // Should not be rate limited (old messages cleaned up, only 4 recent)
679679 require .False (t , isRateLimited (player ))
680-
680+
681681 // Verify cleanup happened
682682 require .Equal (t , 4 , len (player .messageTimestamps ))
683683}
0 commit comments