[ENH] Send / Reply messages should consider rate limits #3

Closed
opened 2023-11-29 01:08:41 -05:00 by modulatingforce · 3 comments

Recently noticed that the bot got temporarily shadowbanned because it may have reached rate limits as described here

https://dev.twitch.tv/docs/irc/#rate-limits

To address this in the test bot, I added variables ratelimittimer :bool , ratelimitstart :Instant , ratelimitcounter :i32 for at least covering a single reply test

Ideally instead, both Reply & Say should be called only after rate limits are considered. For example, some function called first that helps determine if it will send the message or either queue it or not end it at all if the message will reach rate limits


Not a high priority at the moment as long as I have relatively controlled tests, and the current functionality using the above variables seem to work at the moment. However, the current implementation will likely get bulky if I have to define it for each method that is related to reply/say

Recently noticed that the bot got temporarily shadowbanned because it may have reached rate limits as described here https://dev.twitch.tv/docs/irc/#rate-limits To address this in the test bot, I added variables `ratelimittimer :bool` , `ratelimitstart :Instant` , `ratelimitcounter :i32` for at least covering a single reply test Ideally instead, both Reply & Say should be called only after rate limits are considered. For example, some function called first that helps determine if it will send the message or either queue it or not end it at all if the message will reach rate limits --- Not a high priority at the moment as long as I have relatively controlled tests, and the current functionality using the above variables seem to work at the moment. However, the current implementation will likely get bulky if I have to define it for each method that is related to reply/say
modulatingforce added the
Kind/Enhancement
Priority
Low
labels 2023-11-29 01:08:41 -05:00
modulatingforce added this to the Rust Learning project 2023-11-29 01:08:41 -05:00
Author
Owner

One possible way to design this is maybe to have a function called that tracks these variables per channel, and outputs whether the rate is likely reached or not. If it has not been reached, the say/reply function can be executed

One possible way to design this is maybe to have a function called that tracks these variables per channel, and outputs whether the rate is likely reached or not. If it has not been reached, the say/reply function can be executed
modulatingforce added this to the Prototype 1.0 milestone 2023-12-10 16:40:59 -05:00
modulatingforce self-assigned this 2023-12-19 00:48:52 -05:00
Author
Owner

I developed a somewhat rudimentary one in b1c2c2b099

I'm at least not facing any mutability/borrowing issues. lule and this is a bit simpler than code provided by tori, though also less robust than tori's


For now, considering this ready for review for completion . If there are further enhanced requirements in the future, I can create a new issue for that enhancement; if there are issues with the current rate limiters, I can

I developed a somewhat rudimentary one in https://git.flake.sh/modulatingforce/forcebot_rs/commit/b1c2c2b0997f32e3d9a64db608ba7c5955a3102c I'm at least not facing any mutability/borrowing issues. lule and this is a bit simpler than code provided by tori, though also less robust than tori's --- For now, considering this ready for review for completion . If there are further enhanced requirements in the future, I can create a new issue for that enhancement; if there are issues with the current rate limiters, I can
Author
Owner

The Core Code behind RateLimiter continues to work, defined in https://git.flake.sh/modulatingforce/forcebot_rs/src/branch/main/src/core/ratelimiter.rs

There may be areas where the RateLimiter will be used, such as when a BotInstance needs to determine whether to send a message or not, but these would be external from the code of RateLimiter

If needed, I can either Enhance on the fly or add separate Issues to Enhance RateLimiter further

Considering this Issue Resolved

The Core Code behind `RateLimiter` continues to work, defined in https://git.flake.sh/modulatingforce/forcebot_rs/src/branch/main/src/core/ratelimiter.rs There may be areas where the `RateLimiter` will be used, such as when a `BotInstance` needs to determine whether to send a message or not, but these would be external from the code of `RateLimiter` If needed, I can either Enhance on the fly or add separate Issues to Enhance RateLimiter further Considering this Issue Resolved
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: modulatingforce/forcebot_rs#3
No description provided.