Skip to content

Add with_retry helper for retrying Matrix API calls - #116

Merged
PenguinBoi12 merged 2 commits into
mainfrom
api-with_retry
Jul 23, 2026
Merged

Add with_retry helper for retrying Matrix API calls#116
PenguinBoi12 merged 2 commits into
mainfrom
api-with_retry

Conversation

@PenguinBoi12

Copy link
Copy Markdown
Contributor

Description

Adds a with_retry helper to matrix/api.py, as discussed in #86 (review comment).

Note: matrix-nio already retries 429s/timeouts internally (ClientConnectionError/TimeoutError/asyncio.TimeoutError), it does not cover other transport failures like a mid-request server disconnection. This is an additional mechanism for those failures that can still happen.

Additionally, a new error, MatrixApiError has been added to handle possible API error and contain the retry information.

Type of Change

  • Feature
  • Refactor
  • Bug fix
  • Documentation
  • Other: ___

Pre-merge Checklist

  • Run tests: pytest
  • Run type check: mypy
  • Run formatting: `black .

@chrisdedman chrisdedman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM. This will be very useful for our users. thanks

# Conflicts:
#	matrix/api.py
#	tests/test_api.py
@PenguinBoi12
PenguinBoi12 requested a review from chrisdedman July 23, 2026 00:54
@PenguinBoi12
PenguinBoi12 merged commit 55dd594 into main Jul 23, 2026
4 checks passed
@PenguinBoi12
PenguinBoi12 deleted the api-with_retry branch July 23, 2026 00:57

@chrisdedman chrisdedman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

PenguinBoi12 added a commit that referenced this pull request Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature A new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants