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

refact(skymp5-server): replace Axios with fetch-retry in login.ts #2273

Merged
merged 2 commits into from
Jan 10, 2025

Conversation

Pospelove
Copy link
Contributor

@Pospelove Pospelove commented Dec 19, 2024

Important

Replace Axios with fetch-retry for HTTP requests in login.ts, adding retry logic and updating dependencies in package.json.

  • Dependencies:
    • Add @types/node and fetch-retry to package.json.
  • HTTP Requests:
    • Replace Axios with fetch-retry in login.ts for HTTP requests.
    • Add getFetchOptions() in login.ts for retry logic with 10 retries on network errors or 5xx status codes.
  • Error Handling:
    • Update error handling in getUserProfile() and Discord API requests in login.ts to use fetch-retry responses.

This description was created by Ellipsis for 00910f2. It will automatically update as commits are pushed.

@ellipsis-dev ellipsis-dev bot changed the title . refactor: replace Axios with fetch-retry in login.ts Dec 19, 2024
@Pospelove Pospelove changed the title refactor: replace Axios with fetch-retry in login.ts refact(skymp5-server): replace Axios with fetch-retry in login.ts Dec 19, 2024
@Pospelove Pospelove requested a review from nic11 December 19, 2024 00:06
Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

❌ Changes requested. Reviewed everything up to 00910f2 in 2 minutes and 54 seconds

More details
  • Looked at 167 lines of code in 2 files
  • Skipped 1 files when reviewing.
  • Skipped posting 4 drafted comments based on config settings.
1. skymp5-server/ts/systems/login.ts:4
  • Draft comment:
    Consider renaming the import to fetchRetryFactory or similar to clarify its usage.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The fetch-retry import is not used directly; instead, fetchRetry.default(global.fetch) is used. This can be confusing.
2. skymp5-server/ts/systems/login.ts:239
  • Draft comment:
    Consider initializing fetchRetry in the constructor for clarity.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The fetchRetry initialization is done at the class level, which is fine, but it might be clearer to initialize it in the constructor.
3. skymp5-server/ts/systems/login.ts:59
  • Draft comment:
    Consider including the URL or request details in the error message for better debugging.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable:
    The error occurs in getUserProfile() which already has good error handling. The URL can be derived from the masterUrl and myAddr variables. The status code is included. There's extensive logging elsewhere. Adding the URL here would be redundant since it's logged in other places and can be determined from the context.
    The URL could be helpful for immediate debugging without having to look at other log lines. The current error message is somewhat terse.
    The error is already identifiable through the function name prefix and status code. The URL is logged in multiple other places and can be reconstructed from class variables.
    The comment suggests a minor improvement that would be redundant given the existing logging and error handling. The current error message is sufficient.
4. skymp5-server/ts/systems/login.ts:198
  • Draft comment:
    Consider implementing a fallback or additional handling for errors when sending messages to Discord.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The fetchRetry call for sending a message to Discord logs an error but does not handle it further. It might be useful to have a fallback or retry mechanism.

Workflow ID: wflow_o9aNSghCJOQzSmvt


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

skymp5-server/ts/systems/login.ts Outdated Show resolved Hide resolved
@Pospelove
Copy link
Contributor Author

@nic11 please review for obvious mistakes

@Pospelove Pospelove merged commit 1c587ed into skyrim-multiplayer:main Jan 10, 2025
9 checks passed
@Pospelove Pospelove deleted the fetch branch January 10, 2025 18:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant