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 Telegram ratelimit on live setting change #2100

Merged
merged 6 commits into from
Jun 6, 2023

Conversation

vadimkerr
Copy link
Member

@vadimkerr vadimkerr commented Jun 5, 2023

What this PR does

Fixes #1103, inspired by #1934.

Makes sure that:

  1. LiveSettings.validate_settings is only called once per update request and not called for any individual LiveSetting instance save.
  2. telegram.Bot.set_webhook is only called once per request when changing TELEGRAM_WEBHOOK_HOST.

Which issue(s) this PR fixes

#1103

Checklist

  • Unit, integration, and e2e (if applicable) tests updated
  • Documentation added (or pr:no public docs PR label added if not required)
  • CHANGELOG.md updated (or pr:no changelog PR label added if not required)

@vadimkerr vadimkerr added the pr:no public docs Added to a PR that does not require public documentation updates label Jun 5, 2023
"""
if self.name not in self.AVAILABLE_NAMES:
raise ValueError(
f"Setting with name '{self.name}' is not in list of available names {self.AVAILABLE_NAMES}"
)

self.error = LiveSettingValidator(live_setting=self).get_error()
Copy link
Member Author

@vadimkerr vadimkerr Jun 5, 2023

Choose a reason for hiding this comment

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

Moving validation to LiveSetting.validate_settings to avoid multiple validation calls.

@vadimkerr vadimkerr requested a review from mderynck June 5, 2023 16:18
@vadimkerr vadimkerr marked this pull request as ready for review June 5, 2023 16:18
@vadimkerr vadimkerr requested a review from a team as a code owner June 5, 2023 16:18
@alexintech
Copy link
Contributor

Great! That's really fixes an issue.

@vadimkerr vadimkerr enabled auto-merge June 6, 2023 15:14
@vadimkerr vadimkerr added this pull request to the merge queue Jun 6, 2023
Merged via the queue into dev with commit 3d7c044 Jun 6, 2023
@vadimkerr vadimkerr deleted the vadimkerr/live-settings-telegram-webhook branch June 6, 2023 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr:no public docs Added to a PR that does not require public documentation updates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Telegram integration error "Flood control exceeded"
3 participants