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

Исправление асинхронных вызовов в weather updater #128

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mazixs
Copy link

@mazixs mazixs commented Sep 17, 2024

В исходном коде использовался блокирующий вызов open() для чтения файлов. Я заменил его на асинхронный aiofiles.open() — это улучшит производительность. Добавил проверку на случай, если файл перевода не найден или в нем отсутствует нужный ключ. Теперь вместо ошибки компонент будет возвращать исходное значение.

@IATkachenko
Copy link
Owner

IATkachenko commented Sep 18, 2024

Спасибо!
Дополнительные return не нужны: если выброшено пойманное исключение продолжится выполнение основной ветки кода и отработает общий retrun c неизменным value.

И стилистически ошибки тоже поправьте, пожалуйста, чтобы flake8 проходил.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
2 participants