Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename pending request channels with the amount of pending requests in that channel #136

Closed
wants to merge 12 commits into from

Conversation

chandler05
Copy link
Member

Purpose

Closes #68

Approach

New config for channel names

Future work

@urielsalis urielsalis closed this Dec 1, 2020
@urielsalis urielsalis reopened this Dec 1, 2020
@chandler05 chandler05 changed the title Rename pending request channels with the amount of pending requests in that channel Rename pending request channels with the amount of pending requests in that channel Dec 2, 2020
@chandler05
Copy link
Member Author

This gets the bot Rate Limited very quickly, I don't know if there is any way to do this while getting around rate limiting

Copy link
Member

@violine1101 violine1101 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A way in which this could work without catching the rate limit is by not updating the name of the channel every time a new request is posted, but rather have a task updating the channel name regularily (e.g. every 10 minutes, but that should be configurable). It might be difficult to keep track of the amount of requests in a channel though. However, the way it's implemented now, we'd probably run into rate limits constantly.
For reference, the rate limit for channel name and topic updates is 2 updates per 10 minutes per channel.

this.logChannel = config.get( 'request.logChannel' );

if ( this.channels.length !== this.internalChannels.length ) {
throw new Error( 'There are not exactly as many Request channels and ' );
}
if ( this.internalChannels.length !== this.internalChannelNames.length ) {
throw new Error( 'There are not exactly as many Internal channels and ' );

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... and what?

Suggested change
throw new Error( 'There are not exactly as many Internal channels and ' );
throw new Error( 'There are not exactly as many Internal channels as associated names' );

@urielsalis
Copy link
Member

I would keep in memory the number of requests open, and update both the pending requests and the normal requests channel(for transparency)

As for when to update, I think we should keep a timer of 1 min per channel. Every time that there is a change(ticket resolved), start the timer. Reset it back to 1 minute if there is another change. After the 1 min update both channel names

@violine1101
Copy link
Member

violine1101 commented Mar 2, 2021

I would keep in memory the number of requests open, and update both the pending requests and the normal requests channel(for transparency)

For the normal channels, I think it makes more sense to update the channel topic for the public channels. But yeah, it would be nice to have that count public too.

As for when to update, I think we should keep a timer of 1 min per channel. Every time that there is a change(ticket resolved), start the timer. Reset it back to 1 minute if there is another change. After the 1 min update both channel names

This will just cause the bot to get rate limited by Discord, or alternatively, the channel name to never be updated.

I'm probably going to open a completely new PR for this, so I'm going to copy these considerations to the issue.

@urielsalis
Copy link
Member

This will just cause the bot to get rate limited by Discord, or alternatively, the channel name to never be updated.

If its only updated 1 minute after the last change, I dont think it will get rate limited. Way more chances that every 10 mins too

@violine1101
Copy link
Member

The rate limit is 2 channel renames per 10 minutes, as I said. In the worst case with your method the channel can be renamed up to 9 times in that time frame.

@chandler05
Copy link
Member Author

Closing due to rate limiting and violine's assignment.

@chandler05 chandler05 closed this May 11, 2021
@SPGoding SPGoding deleted the pending-requests-renaming branch May 11, 2021 13:29
@SPGoding SPGoding restored the pending-requests-renaming branch May 11, 2021 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rename pending request channels with amount of pending requests
4 participants