Skip to content
This repository has been archived by the owner on Mar 6, 2024. It is now read-only.

add retries #60

Merged
merged 2 commits into from
Mar 19, 2023
Merged

add retries #60

merged 2 commits into from
Mar 19, 2023

Conversation

harjotgill
Copy link
Contributor

@harjotgill harjotgill commented Mar 19, 2023

Summary by OpenAI

Release Notes

This pull request adds retry functionality to improve the reliability of sending messages using the OpenAI API. It includes a new function called retry in the src/utils.ts file and modifies the src/bot.ts file to use this function for retrying message sending in case of failure. This is a "New Feature" that enhances the user experience by reducing the likelihood of failed message sending.

@github-actions
Copy link
Contributor

🤖 OpenAI

Thank you for letting me participate in the code review.

The purpose of this pull request is to add retry functionality to improve the reliability of sending messages using the OpenAI API. The changes include adding a new function called retry in the src/utils.ts file and modifying the src/bot.ts file to use this function for retrying message sending in case of failure.

Here is a summary of the changes made in each file:

File Changes
src/bot.ts Importing a new module utils.js. Adding a new function call retry() from the utils module to retry sending a message in case of failure. Changing the timeout for sending a message from 90 seconds to 60 seconds. Removing two commented lines of code that were not being used. Adding logging statements to print the response and the time taken to send a message, including retries.
src/utils.ts Adding a new function called retry that takes three arguments: a function to be retried, an array of arguments to be passed to that function, and the number of times the function should be retried. The retry function uses a for loop to execute the provided function with the given arguments. If the function throws an error, the function logs a warning message indicating the failure and continues to retry the function until it succeeds or the maximum number of retries is reached. If the maximum number of retries is reached, the function throws the last error encountered.

Overall, the changes seem reasonable and well-documented.


Tips:

  • You can reply on the review comment left by this bot to ask follow-up questions.
  • You can invite the bot into a review conversation by typing @openai in the beginning of the comment.

@harjotgill harjotgill added this pull request to the merge queue Mar 19, 2023
@harjotgill harjotgill merged commit 0725526 into main Mar 19, 2023
@harjotgill harjotgill deleted the retry branch March 19, 2023 16:46
shoyuf pushed a commit to maybeLab/openai-mr-reviewer-gltlab that referenced this pull request Jun 25, 2023
<!-- This is an auto-generated comment: release notes by openai -->
### Summary by OpenAI

**Release Notes**

This pull request adds retry functionality to improve the reliability of
sending messages using the OpenAI API. It includes a new function called
`retry` in the `src/utils.ts` file and modifies the `src/bot.ts` file to
use this function for retrying message sending in case of failure. This
is a "New Feature" that enhances the user experience by reducing the
likelihood of failed message sending.
<!-- end of auto-generated comment: release notes by openai -->
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant