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:Improve error handling when a request fails due to the persistent connection being expired #761 #854

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

avijitdas126
Copy link
Collaborator

Enhanced the do_api_query function with a retry mechanism (up to 3 attempts) for transient connection errors, configurable retry delays, and keep-alive headers. It resets the HTTP session on failures, differentiates between network errors and API errors, and maintains backward compatibility while improving reliability with optimized timeouts (90s for long-polling, 15s default).

  • Implement retry mechanism (up to 3 attempts) for transient connection errors
  • Add configurable retry delay and connection keep-alive headers
  • Reset HTTP session on connection failures to ensure clean reconnect
  • Differentiate between retryable network errors and API response errors
  • Set appropriate timeouts (90s for long-polling, 15s default otherwise)
  • Maintain backward compatibility while improving error resilience

Fixes: #761

How did you test this PR?

Self-review checklist
  • Self-reviewed the changes for clarity and maintainability
    (variable names, code reuse, readability, etc.).

Communicate decisions, questions, and potential concerns.

  • Explains differences from previous plans (e.g., issue description).
  • Highlights technical choices and bugs encountered.
  • Calls out remaining decisions and concerns.
  • Automated tests verify logic where appropriate.

Individual commits are ready for review (see commit discipline).

  • Each commit is a coherent idea.
  • Commit message(s) explain reasoning and motivation for changes.

Completed manual review and testing of the following:

  • Visual appearance of the changes.
  • Responsiveness and internationalization.
  • Strings and tooltips.
  • End-to-end functionality of buttons, interactions and flows.
  • Corner cases, error conditions, and easily imagined bugs.

Enhanced the do_api_query function with a retry mechanism (up to 3 attempts) for transient connection errors, configurable retry delays, and keep-alive headers. It resets the HTTP session on failures, differentiates between network errors and API errors, and maintains backward compatibility while improving reliability with optimized timeouts (90s for long-polling, 15s default).
Added missing whitespace for better readability and fixed minor typos in help_message and alert_move_message. Improved assertions and refactored redundant checks for cleaner test logic.
@zulipbot
Copy link
Member

zulipbot commented Feb 5, 2025

Hello @avijitdas126, it seems like you have referenced #761 in your pull request description, but you have not referenced them in your commit message description(s). Referencing an issue in a commit message automatically closes the corresponding issue when the commit is merged, which makes the issue tracker easier to manage.

Please run git commit --amend in your command line client to amend your commit message description with Fixes #761..

An example of a correctly-formatted commit:

commit fabd5e450374c8dde65ec35f02140383940fe146
Author: zulipbot
Date:   Sat Mar 18 13:42:40 2017 -0700

    pull requests: Check PR commits reference when issue is referenced.

    Fixes #51.

To learn how to write a great commit message, please refer to our guide.

1 similar comment
@zulipbot
Copy link
Member

zulipbot commented Feb 5, 2025

Hello @avijitdas126, it seems like you have referenced #761 in your pull request description, but you have not referenced them in your commit message description(s). Referencing an issue in a commit message automatically closes the corresponding issue when the commit is merged, which makes the issue tracker easier to manage.

Please run git commit --amend in your command line client to amend your commit message description with Fixes #761..

An example of a correctly-formatted commit:

commit fabd5e450374c8dde65ec35f02140383940fe146
Author: zulipbot
Date:   Sat Mar 18 13:42:40 2017 -0700

    pull requests: Check PR commits reference when issue is referenced.

    Fixes #51.

To learn how to write a great commit message, please refer to our guide.

@zulipbot zulipbot added size: L and removed size: M labels Feb 5, 2025
Added missing whitespace for better readability and fixed minor typos in help_message and alert_move_message. Improved assertions and refactored redundant checks for cleaner test logic.
@avijitdas126 avijitdas126 force-pushed the fix/enhance-api-reliability-retries-keepalive-761 branch from 95f88af to 078a153 Compare February 5, 2025 15:43
@avijitdas126
Copy link
Collaborator Author

@timabbott could you please review this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve error handling when a request fails due to the persistent connection being expired
2 participants