mirror of
https://github.com/AstrBotDevs/AstrBot.git
synced 2026-09-01 15:32:49 +08:00
fix: handle rate_limit_count=0 to prevent IndexError (#7635)
* fix: handle rate_limit_count=0 to prevent IndexError * Update astrbot/core/pipeline/rate_limit_check/stage.py Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --------- Co-authored-by: Soulter <37870767+Soulter@users.noreply.github.com> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
@@ -63,6 +63,8 @@ class RateLimitStage(Stage):
|
||||
timestamps = self.event_timestamps[session_id]
|
||||
self._remove_expired_timestamps(timestamps, now)
|
||||
|
||||
if self.rate_limit_count <= 0:
|
||||
break
|
||||
if len(timestamps) < self.rate_limit_count:
|
||||
timestamps.append(now)
|
||||
break
|
||||
|
||||
Reference in New Issue
Block a user