Skip to content

Commit 585de56

Browse files
committed
rename minute -> slot in rate limiter, as the length is a parameter
1 parent 1e7ba5c commit 585de56

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

chia/server/rate_limits.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
class RateLimiter:
1919
incoming: bool
2020
reset_seconds: int
21-
current_minute: int
21+
current_slot: int
2222
message_counts: Counter[ProtocolMessageTypes]
2323
message_cumulative_sizes: Counter[ProtocolMessageTypes]
2424
percentage_of_limit: int
@@ -35,7 +35,7 @@ def __init__(self, incoming: bool, reset_seconds: int = 60, percentage_of_limit:
3535
"""
3636
self.incoming = incoming
3737
self.reset_seconds = reset_seconds
38-
self.current_minute = int(monotonic() // reset_seconds)
38+
self.current_slot = int(monotonic() // reset_seconds)
3939
self.message_counts = Counter()
4040
self.message_cumulative_sizes = Counter()
4141
self.percentage_of_limit = percentage_of_limit
@@ -51,9 +51,9 @@ def process_msg_and_check(
5151
hit and the message is good to be sent or received.
5252
"""
5353

54-
current_minute = int(monotonic() // self.reset_seconds)
55-
if current_minute != self.current_minute:
56-
self.current_minute = current_minute
54+
current_slot = int(monotonic() // self.reset_seconds)
55+
if current_slot != self.current_slot:
56+
self.current_slot = current_slot
5757
self.message_counts = Counter()
5858
self.message_cumulative_sizes = Counter()
5959
self.non_tx_message_counts = 0

0 commit comments

Comments
 (0)