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

Add periodic connection refresh #964

Merged
merged 5 commits into from
May 24, 2024
Merged

Add periodic connection refresh #964

merged 5 commits into from
May 24, 2024

Conversation

javiercr
Copy link
Member

@javiercr javiercr commented May 23, 2024

Context

We've observed some scenarios where users stop getting messages. Reconnecting them seems to solve the issue.

Description

This PR adds a new force_refresh_interval_seconds config option to force the connection to be refreshed. Default is 0 (disables force refresh). This is the equivalent to mautrix/meta#58.

How to test this

Clone the branch, change force_refresh_interval_seconds to a small interval (eg: 10 seconds), run the bridge locally and you should see:

[2024-05-23 17:08:38,712] [[email protected].@REDACTED] Scheduling forced reconnect in 20 seconds. Connection will be refreshed at 2024-05-23 17:08:58

[2024-05-23 17:08:58,714] [[email protected].@REDACTED] Reconnecting to Telegram...
[2024-05-23 17:08:58,716] [[email protected]] Disconnecting from 149.154.167.91:443/TcpFull...
[2024-05-23 17:08:58,720] [[email protected]] Disconnection from 149.154.167.91:443/TcpFull complete!
[2024-05-23 17:08:58,722] [[email protected]] Update loop finished
[2024-05-23 17:08:58,740] [[email protected]] Saving update states
[2024-05-23 17:08:58,741] [[email protected].@REDACTED] Initializing client for @REDACTED
[2024-05-23 17:08:58,742] [[email protected].@REDACTED] Scheduling forced reconnect in 20 seconds. Connection will be refreshed at 2024-05-23 17:09:18
[2024-05-23 17:08:58,742] [[email protected]] Connecting to 149.154.167.91:443/TcpFull...
[2024-05-23 17:08:58,775] [[email protected]] Connection to 149.154.167.91:443/TcpFull complete!

[2024-05-23 17:09:18,743] [[email protected].@REDACTED] Reconnecting to Telegram...
[2024-05-23 17:09:18,743] [[email protected]] Disconnecting from 149.154.167.91:443/TcpFull...
[2024-05-23 17:09:18,744] [[email protected]] Disconnection from 149.154.167.91:443/TcpFull complete!
[2024-05-23 17:09:18,744] [[email protected]] Update loop finished
[2024-05-23 17:09:18,745] [[email protected]] Saving update states
[2024-05-23 17:09:18,746] [[email protected].@REDACTED] Initializing client for @REDACTED
[2024-05-23 17:09:18,746] [[email protected].@REDACTED] Scheduling forced reconnect in 20 seconds. Connection will be refreshed at 2024-05-23 17:09:38

Make sure you're still able to send and receive messages.

@javiercr javiercr requested a review from tulir May 23, 2024 15:11
mautrix_telegram/abstract_user.py Outdated Show resolved Hide resolved
mautrix_telegram/example-config.yaml Outdated Show resolved Hide resolved
@javiercr javiercr requested a review from tulir May 24, 2024 07:39
Copy link
Member

@tulir tulir left a comment

Choose a reason for hiding this comment

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

Looks sensible

@javiercr javiercr merged commit f6cb26f into master May 24, 2024
5 checks passed
@javiercr javiercr deleted the feature/periodic-refresh branch May 24, 2024 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants