Skip to content

Fixed /github-search command failing in some cases#1435

Open
Zabuzard wants to merge 1 commit intodevelopfrom
bugfix/gh_search_command_not_defer
Open

Fixed /github-search command failing in some cases#1435
Zabuzard wants to merge 1 commit intodevelopfrom
bugfix/gh_search_command_not_defer

Conversation

@Zabuzard
Copy link
Member

What looks inoccent in the code reference.findIssue(...) is actually running API queries in the background. So it is not a quick command.

The code apparently overlooked this and did not make use of JDAs event.deferReply().queue(). In many cases this then leads to the action crashing because it takes longer than 3 seconds:

not ack

This fixes the code by properly using deferReply and then responding through the InteractionHook.

While at it, the PR also fixes a bug with the code in the edge case that the configured GitHub repos have no issues yet (or more commonly when a githubApiKey has not been set up yet). In this case the autocompletion code crashed because it was supplying an empty list. This is now fixed by supplying no issues found in that edge case.

@Zabuzard Zabuzard self-assigned this Mar 11, 2026
@Zabuzard Zabuzard requested a review from a team as a code owner March 11, 2026 15:07
@Zabuzard Zabuzard added bug Something isn't working priority: normal labels Mar 11, 2026
@sonarqubecloud
Copy link

List<String> choices = Stream.generate(closestSuggestions::poll).limit(25).toList();
event.replyChoiceStrings(choices).queue();
if (choices.isEmpty()) {
choices = List.of("no issue found");
Copy link
Contributor

Choose a reason for hiding this comment

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

If this expression is supposed to be shown on UI, I believe it should start with Uppercase

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working priority: normal

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants