poke-env icon indicating copy to clipboard operation
poke-env copied to clipboard

Throw exception when being rate limited (or handle rate limits within poke_env itself)

Open Jay2645 opened this issue 5 years ago • 0 comments

Feature request -- would it be possible to throw an exception when we're being rate limited? This is the Showdown code:

if (this.chatQueue.length >= THROTTLE_BUFFER_LIMIT - 1) {
	connection.sendTo(
		room,
		`|raw|<strong class="message-throttle-notice">Your message was not sent because you've been typing too quickly.</strong>`
	);
	return false;

IIRC, right now that raw tag is being handled in battle.py, where it tries to parse it as a rating instead. I feel like something lower-level should be listening to this and throwing an exception or something to let you know you're being rate limited. Alternatively, if poke_env could handle the rate limiting itself (either by resending after a delay if it gets that message or keeping track on its own), that'd work too.

Originally posted by @Jay2645 in https://github.com/hsahovic/poke-env/issues/88#issuecomment-724272314

Jay2645 avatar Nov 09 '20 23:11 Jay2645