stream-chat-python icon indicating copy to clipboard operation
stream-chat-python copied to clipboard

add throttling option to campaigns API?

Open jmensch1 opened this issue 1 year ago • 5 comments

Per your docs, the Campaigns api sends messages at a rate of about 60000 per minute. (https://getstream.io/chat/docs/python/campaign_api/?language=python). Would it be possible to add a throttling option so that these messages get sent more slowly, at a rate specified by the user?

The reason is that we have a server that handles the webhooks for new message events. Normally that server handles at most a few hundred events per minute. If that number were to jump to 60000 / minute without any ramp-up time, the server would undoubtedly crash.

jmensch1 avatar Apr 01 '24 22:04 jmensch1

Hey @jmensch1,

Thank you for the feedback!

Would disabling webhooks for messages generated by the campaign be a viable option for you in this case? There are skip_webhook and skip_push params to skip Webhook and Push events accordingly.

cc @vishalnarkhede

kanat avatar Apr 01 '24 22:04 kanat

Hi @kanat, thanks for getting back to me.

I saw the skip options in the docs. Unfortunately those won't work in our case because we actually want to process the new-message webhooks for a variety of reasons.

Jake

jmensch1 avatar Apr 02 '24 19:04 jmensch1

Hi @jmensch1,

Thank you for the update! We will add this to our backlog 👍

kanat avatar Apr 03 '24 01:04 kanat

Hi @jmensch1,

Would SQS be an option for you in this matter?

kanat avatar Apr 04 '24 20:04 kanat

Hi @kanat,

I didn't know about that. It's a nice solution and would probably work from a technical point of view. The only problem is that all of our infrastructure is on GCP, and I don't think there would be a lot of interest in opening an account with AWS just for this purpose.

Just so you know, when Stream shut down the first Campaigns api a few months ago, I wrote a service for sending campaigns using the regular Messaging api. It's a bit slow, since I need to stay under the rate limit, but it's working well enough. So it's not urgent for us to use the new Campaigns api right now. I might try it again at some point in the future.

Thanks Jake

jmensch1 avatar Apr 04 '24 21:04 jmensch1