Skip to content

Prevent to crash polling #995

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

Merged
merged 2 commits into from
Aug 29, 2022
Merged

Prevent to crash polling #995

merged 2 commits into from
Aug 29, 2022

Conversation

JrooTJunior
Copy link
Member

Description

Sometime Telegram restart the server with HTTP 429 error, so that's mean we need to handle it in polling mode

Type of change

  • Bug fix (non-breaking change that fixes an issue)

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have added tests that prove my fix is effective or that my feature works as expected
  • New and existing unit tests pass locally with my changes
  • My changes generate no new warnings or errors
  • My changes are compatible with minimum requirements of the project
  • I have made corresponding changes to the documentation

@JrooTJunior JrooTJunior added bug Something is wrong with the framework 3.x Issue or PR for stable 3.x version labels Aug 29, 2022
@JrooTJunior JrooTJunior added this to the 3.0.0-beta.5 milestone Aug 29, 2022
@github-actions
Copy link

github-actions bot commented Aug 29, 2022

✔️ Changelog found.

Thank you for adding a description of the changes

@aiogram aiogram deleted a comment from github-actions bot Aug 29, 2022
@codecov
Copy link

codecov bot commented Aug 29, 2022

Codecov Report

Merging #995 (edd611f) into dev-3.x (a812a40) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##           dev-3.x      #995   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          303       303           
  Lines         8216      8216           
=========================================
  Hits          8216      8216           
Flag Coverage Δ
unittests 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
aiogram/dispatcher/dispatcher.py 100.00% <100.00%> (ø)

@JrooTJunior JrooTJunior marked this pull request as ready for review August 29, 2022 22:46
@JrooTJunior JrooTJunior merged commit 0b5f4d6 into dev-3.x Aug 29, 2022
except (TelegramNetworkError, TelegramServerError) as e:
# In cases when Telegram Bot API was inaccessible don't need to stop polling process
# because some of developers can't make auto-restarting of the script
except Exception as e:
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe this would be better? Too broad except clause can be bad, even if we won't get any other error.

Suggested change
except Exception as e:
except TelegramAPIError as e:

@JrooTJunior JrooTJunior deleted the misc/prevent-crash-polling branch February 12, 2023 00:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.x Issue or PR for stable 3.x version bug Something is wrong with the framework
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants