-
-
Notifications
You must be signed in to change notification settings - Fork 329
Open
Description
It looks like the feed_deactivated_warn
message is always being sent to the user who subscribed to the feed, but if I set the ERROR_LOGGING_CHAT
, I would expect that chat to receive all error messages.
RSS-to-Telegram-Bot/src/monitor/_notifier.py
Lines 220 to 271 in 5a67570
lang_msg_body_map: dict[str, str] = { | |
lang: '\n'.join(( | |
i18n[lang]['feed_deactivated_warn'], | |
( | |
( | |
reason.i18n_message(lang) | |
if isinstance(reason, web.WebError) | |
else reason | |
) | |
if reason | |
else '' | |
) | |
)) | |
for lang in user_id_lang_map.values() | |
} | |
sub_count = len(subs) | |
feed_description = f'{feed.id}: {feed.link}' | |
del reason | |
_do_send: BatchTimeout[[db.Sub, str], None] | |
async with BatchTimeout[[db.Sub, str], None]( | |
func=self._do_send, | |
timeout=TIMEOUT, | |
loop=env.loop, | |
on_success=self._on_subtask_deactivated, | |
on_canceled=self._on_subtask_canceled, | |
on_error=self._on_subtask_unknown_error, | |
on_timeout=self._on_subtask_timeout, | |
on_timeout_error=self._on_subtask_timeout_unknown_error, | |
) as _do_send: | |
for sub in subs: | |
_do_send( | |
sub=sub, | |
post=( | |
f'<a href="{feed.link}">{escape_html(sub.title or feed.title)}</a>\n' + | |
lang_msg_body_map[user_id_lang_map[sub.user_id]] | |
) | |
) | |
del sub, subs, feed, user_id_lang_map, lang_msg_body_map | |
logger.debug(f'Deactivated {sub_count} subs: {feed_description}') | |
async def _do_send(self, sub: db.Sub, post: Union[str, Post]) -> None: | |
self._stat.start() | |
try: | |
await self._send(sub, post) | |
finally: | |
self._stat.finish() | |
async def _send(self, sub: db.Sub, post: Union[str, Post]) -> None: | |
user_id = sub.user_id |
Metadata
Metadata
Assignees
Labels
No labels