Skip to content

Commit

Permalink
Lower YouTube poll time from 15s → 5s
Browse files Browse the repository at this point in the history
(my quota-increase request was approved, so I now have 60k quota instead
of 10k)
  • Loading branch information
AdamLearns committed Mar 26, 2024
1 parent de145fb commit 966f562
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions packages/bots/src/youtube/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,11 @@ let nextPageToken: string | undefined

/**
* The number of milliseconds that we MUST wait before polling for chat
* messages. This is because the quota is quite restrictive at 10k requests per
* day, so 1 request per second would use it all up in 2.7 hours, and I stream
* for ~6 hours per day right now. Also, I'm pretty sure reading chat messages
* costs more than one quota point per request.
* messages. If this is set to 15000 and I stream for about 7 hours in a given
* day (with no real command usage), then I'll be almost exactly at 10k quota
* usage by the end of the calendar day.
*/
const MIN_CHAT_POLLING_TIME = 15_000
const MIN_CHAT_POLLING_TIME = 5000

export async function init(commands: InMemoryCommands): Promise<YouTubeBot> {
const REDIRECT_URI = process.env.YOUTUBE_REDIRECT_URI
Expand Down

0 comments on commit 966f562

Please sign in to comment.