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

Bug: Add a limit on the number of items in the queue to be displayed in the Your last activity message #69

Closed
2 tasks done
obervinov opened this issue Jun 11, 2024 · 0 comments · Fixed by #72
Closed
2 tasks done
Assignees
Labels
bug Something isn't working
Milestone

Comments

@obervinov
Copy link
Owner

obervinov commented Jun 11, 2024

Describe the bug
Now when the queue is too big, the activity widget update thread crashes with an error from telegram API
Error message:

[2024-06-11 10:41:11,546] INFO [logger.logger:update_status_message:282] [Bot]: `status_message` for user 123456789 is outdated, updating 0071f41f8bef3a21d2e20f08ef9cc9d923263d9c6ee9b346fd35ac2ac8cff289 -> eed285fd37c01df5c67d4ac630c00dc81e9fdbe96ce07915e68e9b1b1b57269d...
Exception in thread Thread-message-updater:
Traceback (most recent call last):
  File "/home/pyinstabot-downloader/app/src/bot.py", line 513, in status_message_updater_thread
    update_status_message(user_id=user_id)
  File "/home/pyinstabot-downloader/app/src/bot.py", line 286, in update_status_message
    editable_message = telegram.send_styled_message(
  File "/home/pyinstabot-downloader/app/.venv/lib/python3.9/site-packages/telegram/telegram.py", line 197, in send_styled_message
    response = self.telegram_bot.edit_message_text(
  File "/home/pyinstabot-downloader/app/.venv/lib/python3.9/site-packages/telebot/__init__.py", line 4618, in edit_message_text
    result = apihelper.edit_message_text(
  File "/home/pyinstabot-downloader/app/.venv/lib/python3.9/site-packages/telebot/apihelper.py", line 1356, in edit_message_text
    return _make_request(token, method_url, params=payload, method='post')
  File "/home/pyinstabot-downloader/app/.venv/lib/python3.9/site-packages/telebot/apihelper.py", line 168, in _make_request
    json_result = _check_result(method_name, result)
  File "/home/pyinstabot-downloader/app/.venv/lib/python3.9/site-packages/telebot/apihelper.py", line 195, in _check_result
    raise ApiTelegramException(method_name, result, result_json)
telebot.apihelper.ApiTelegramException: A request to the Telegram API was unsuccessful. Error code: 400. Description: Bad Request: MESSAGE_TOO_LONG

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/threading.py", line 980, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.9/threading.py", line 917, in run
    self._target(*self._args, **self._kwargs)
  File "/home/pyinstabot-downloader/app/src/bot.py", line 523, in status_message_updater_thread
    raise FailedMessagesStatusUpdater(exception_context) from exception
modules.exceptions.FailedMessagesStatusUpdater: {'call': 'Thread-message-updater', 'message': 'Failed to update the message with the status of received messages ', 'users': [('123456789', '123456789')], 'user': ('123456789', '123456789'), 'exception': ApiTelegramException('A request to the Telegram API was unsuccessful. Error code: 400. Description: Bad Request: MESSAGE_TOO_LONG')}

Additional context
Information about where the bug is happening:
None

Possible correction
Add output limit of 10 queue items (closest by processing time) to the widget with activity

Screenshots
None

Check list after fixing the bug

  • The queue returns the next 10 items instead of the full list
  • Also, remove the pinning function of the activity widget (this is not functional and inconvenient)
@obervinov obervinov added the bug Something isn't working label Jun 11, 2024
@obervinov obervinov self-assigned this Jun 11, 2024
@obervinov obervinov added this to the v2.1.6 milestone Jun 14, 2024
obervinov pushed a commit that referenced this issue Jun 14, 2024
bump dependencies versions
@obervinov obervinov linked a pull request Jun 14, 2024 that will close this issue
@obervinov obervinov linked a pull request Jun 18, 2024 that will close this issue
obervinov pushed a commit that referenced this issue Jun 22, 2024
## v2.1.6 - 2024-06-22
### What's Changed
**Full Changelog**: v2.1.5...v2.1.6 by @obervinov in #70
#### 💥 Breaking Changes
* remove unused database `environment` attribute permanent path in the Vault: `configurations/database`
* remove unused environment variable `PROJECT_ENVIRONMENT`
* the automatic queue verification mechanism has been removed. Instead of this method, added functionality to update the queue processing time via a message to the bot
* change the structure of the table `messages`: add a new column `state` and `updated_at`, rename column `timestamp` to `created_at`
#### 🐛 Bug Fixes
* #69
* #62
* #67
* #64
* #65
* Removed duplicates in rights checking
* Small refactoring code
#### 🚀 Features
* Bump dependency versions for modules and workflows
* Add button for rescheduling the queue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Development

Successfully merging a pull request may close this issue.

1 participant