PublicAPI icon indicating copy to clipboard operation
PublicAPI copied to clipboard

Request Multiple Participants

Open stjohnjohnson opened this issue 1 year ago • 1 comments

I'm building a Twitch app that can write to the chat when donations to a participant or team show up. The frequency I was thinking of is checking every minute (since folks are watching live).

While I'm designing this implementation, I'm nervous about making too many calls to the DonorDrive API. If I'm keeping it simple, I need to check the latest values of https://www.extra-life.org/api/participants/X/donations every minute. But I would need to make this call for each participant/team that wants to use my app.

If we have 50 different twitch streams, I then need to make 50 calls per minute. And that's just if I'm only supporting the call to donations. At some point I'd love to post to chat when a milestone is reached (adding another call to /milestones for each participant/twitch stream), but that would put me to 100 calls per minute.

Is there a way to support requesting 2+ participant per call? Like a batch request?

stjohnjohnson avatar Oct 05 '22 23:10 stjohnjohnson

Hi @stjohnjohnson , sorry for the delay in getting back to you.

If you're primarily interested in donation updates, you could poll the Team's donations endpoint (check Team DonorDrive progress) on a 15-30 second interval.

When you detect donations you haven't encountered before, lazy load the associated participant(s), and their milestones. Note: participants aren't usually going to have a ton of volatility, so you could maybe get away with just loading participants/milestones once for the duration of the app's lifecycle, or have some kind of counter to manage the frequency that you're checking on any given participant. You'll have to queue that work somehow, or you will get rate-limited.

Hope this helps!

timmixell avatar Oct 14 '22 01:10 timmixell