python-zulip-api icon indicating copy to clipboard operation
python-zulip-api copied to clipboard

Handle `RATE_LIMIT_HIT` (Rate limit exceeded) errors

Open i-ky opened this issue 2 years ago • 24 comments

It would be nice if this library handled RATE_LIMIT_HIT errors automatically by sleeping for retry-after seconds and retrying the request. Otherwise this logic needs to be implemented in every user application.

i-ky avatar Jan 16 '23 09:01 i-ky

@zulipbot add "enhancement" "help wanted"

i-ky avatar Jan 18 '23 09:01 i-ky

@zulipbot claim

Fahdmoh01 avatar Oct 01 '23 14:10 Fahdmoh01

Welcome to Zulip, @Fahdmoh01! We just sent you an invite to collaborate on this repository at https://github.com/zulip/python-zulip-api/invitations. Please accept this invite in order to claim this issue and begin a fun, rewarding experience contributing to Zulip!

Here's some tips to get you off to a good start:

As you work on this issue, you'll also want to refer to the Zulip code contribution guide, as well as the rest of the developer documentation on that site.

See you on the other side (that is, the pull request side)!

zulipbot avatar Oct 01 '23 14:10 zulipbot

@i-ky does the Rate limit has to do with the message_limit?

Fahdmoh01 avatar Oct 01 '23 14:10 Fahdmoh01

@i-ky does the Rate limit has to do with the message_limit?

Sorry, I am not familiar with Zulip's internals. What is message_limit you are talking about?

i-ky avatar Oct 01 '23 16:10 i-ky

@i-ky does the Rate limit has to do with the message_limit?

Sorry, I am not familiar with Zulip's internals. What is message_limit you are talking about?

message_limit is a variable inside the Ratelimit class of the zulip python api. where do I go to ask for further clarification for this issue?

Fahdmoh01 avatar Oct 01 '23 16:10 Fahdmoh01

I can only clarify what I propose to be changed from a python-zulip-api user's perspective, how it is to be changed from python-zulip-api perspective is a different matter.

i-ky avatar Oct 01 '23 16:10 i-ky

This need to be done as an option -- some clients might very much not want to have sleeps of this form be part of what might happen.

I suppose there's also a question of whether we want the semantics to be to automatically retry the operation that failed due to the rate limit, or something else.

We also need to be cautious in implementing documenting this sort of thing to make sure we don't end up with bugged clients hitting the server exactly as often as the rate limits allow - that can generate a lot more useless load than something that doesn't retry. Probably this is not too hard to manage.

timabbott avatar Oct 01 '23 20:10 timabbott

@Fahdmoh01 You have been unassigned from this issue because you have not made any updates for over 14 days. Please feel free to reclaim the issue if you decide to pick up again. Thanks!

zulipbot avatar Oct 14 '23 21:10 zulipbot

@timabbott Hi, is this issue still up for grabs and is it something that I can start working on...

GeekGawd avatar Nov 11 '23 09:11 GeekGawd

@timabbott claim

grwt avatar Nov 17 '23 14:11 grwt

@zulipbot claim

quinnah avatar Jan 09 '24 21:01 quinnah

Welcome to Zulip, @quinnah! We just sent you an invite to collaborate on this repository at https://github.com/zulip/python-zulip-api/invitations. Please accept this invite in order to claim this issue and begin a fun, rewarding experience contributing to Zulip!

Here's some tips to get you off to a good start:

As you work on this issue, you'll also want to refer to the Zulip code contribution guide, as well as the rest of the developer documentation on that site.

See you on the other side (that is, the pull request side)!

zulipbot avatar Jan 09 '24 21:01 zulipbot

how do i reproduce this?

codewithnick avatar Jan 18 '24 03:01 codewithnick

i tried sending a lot of messages in a loop but it seems to handle it well already image

codewithnick avatar Jan 18 '24 03:01 codewithnick

@codewithnick, try a different API endpoint (e.g. I originally suffered from it while uploading custom emojis). I would assume that Zulip is quite tolerant to bursts of messages sent, but may use stricter limits for other stuff.

Or try harder using multiprocessing/threading/asyncio :wink:

i-ky avatar Jan 18 '24 07:01 i-ky

tried using custom emojis it all looks the same image

I think it is use less to make it any faster even if it fails on multithreads, because then you are basically abusing the api

codewithnick avatar Jan 18 '24 16:01 codewithnick

@codewithnick, you can also try lowering limits for your Zulip server.

i-ky avatar Jan 22 '24 10:01 i-ky

@codewithnick, you can also try lowering limits for your Zulip server.

is there any way to do it? pl lmk

codewithnick avatar Jan 22 '24 16:01 codewithnick

@codewithnick, you can also try lowering limits for your Zulip server.

is there any way to do it? pl lmk

I believe this is the relevant piece of documentation.

i-ky avatar Jan 22 '24 17:01 i-ky

@zulipbot claim

avijitdas126 avatar Jan 27 '25 14:01 avijitdas126

Hello @avijitdas126, it looks like you've currently claimed 1 issue in this repository. We encourage new contributors to focus their efforts on at most 1 issue at a time, so please complete your work on your other claimed issues before trying to claim this issue again.

We look forward to your valuable contributions!

zulipbot avatar Jan 27 '25 14:01 zulipbot

@zulipbot claim

pranavrockz avatar Jan 31 '25 12:01 pranavrockz

Welcome to Zulip, @pranavrockz! We just sent you an invite to collaborate on this repository at https://github.com/zulip/python-zulip-api/invitations. Please accept this invite in order to claim this issue and begin a fun, rewarding experience contributing to Zulip!

Here's some tips to get you off to a good start:

As you work on this issue, you'll also want to refer to the Zulip code contribution guide, as well as the rest of the developer documentation on that site.

See you on the other side (that is, the pull request side)!

zulipbot avatar Jan 31 '25 12:01 zulipbot