Skip to content

fix: stop sender's own send-failure logs from re-triggering broadcast - #467

Merged
alexeyqu merged 1 commit into
masterfrom
dev
Jul 25, 2026
Merged

fix: stop sender's own send-failure logs from re-triggering broadcast#467
alexeyqu merged 1 commit into
masterfrom
dev

Conversation

@alexeyqu

Copy link
Copy Markdown
Collaborator

Summary

  • ErrorBroadcastHandler is attached to the root logger, so any logger.error() call in the app gets forwarded to Telegram via TelegramSender.send_error_log().
  • TelegramSender's own send-failure handling used logger.error(), including when redirecting a failed message to error_logs_recipients itself failed — creating a feedback loop: failed send → broadcast to error chat → that send fails (e.g. flood control) → logged as error → broadcast again → ... This produced the observed storm of hundreds of RetryAfter/PoolTimeout messages to the same chat.
  • Added a skip_broadcast marker respected by ErrorBroadcastHandler.emit(), set on the three logger.error() calls inside TelegramSender's own exception handling. Failures still log locally and the original message is still explicitly forwarded to error_logs_recipients, but the failure-to-notify no longer re-enters the broadcast pipeline.

Test plan

  • pytest tests/unit — all pass except one pre-existing unrelated failure (test_scheduler.py::test_jobs_executed, confirmed failing on dev before this change too)

logger.error() calls inside TelegramSender's exception handling were
picked up by the root-attached ErrorBroadcastHandler and re-sent to
error_logs_recipients. When that broadcast itself failed (e.g. Telegram
flood control), the failure was logged the same way, causing an
unbounded feedback loop of error messages to the same chat. Mark these
specific logs with skip_broadcast so delivery failures are logged
locally but no longer re-enter the broadcast pipeline.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@alexeyqu
alexeyqu merged commit 8051268 into master Jul 25, 2026
3 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant