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

Fix pending after first message #20

Merged
merged 2 commits into from
Jul 27, 2023

Conversation

luke-cha
Copy link
Contributor

Details

Add detailed waiting logic for the issue that Bot's message is pending after sending the first message

How to

Add logic to wait until the last message to the group channel is not null (up to 3 seconds) because it determines that an error occurs when the channel loads immediately after sending a message to the group channel

@luke-cha luke-cha requested a review from AhyoungRyu July 27, 2023 01:26
Comment on lines 52 to 56
let count = 0;
while (groupChannel.lastMessage == null && count < 30) {
await delay(100);
count += 1;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit;

async function waitForLastMessage(groupChannel, maxRetries = 30, retryInterval = 100) {
  let count = 0;
  while (groupChannel.lastMessage == null && count < maxRetries) {
    await delay(retryInterval);
    count++;
  }
  await delay(500);
}

How about having this logic separately and call it in here?

// usage 
await waitForLastMessage(groupChannel);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@AhyoungRyu Your suggestion is also good. Could you update it?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah sure will do.

Copy link
Collaborator

@AhyoungRyu AhyoungRyu left a comment

Choose a reason for hiding this comment

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

Thank you, Luke!

@AhyoungRyu AhyoungRyu merged commit 6ddb603 into develop Jul 27, 2023
1 check passed
@AhyoungRyu AhyoungRyu deleted the luke/fix-pending-after-first-message-issue branch July 27, 2023 02:11
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.

2 participants