Skip to content

Commit eee04a6

Browse files
BukeLyCopilot
andcommitted
Apply suggestion from @Copilot
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 1fa02af commit eee04a6

1 file changed

Lines changed: 12 additions & 6 deletions

File tree

agent-sdk-client/handler.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -280,12 +280,18 @@ def lambda_handler(event: dict, context: Any) -> dict:
280280
'administrator',
281281
):
282282
chat_id = member_update.chat.id
283-
is_ok, error_msg = asyncio.run(
284-
_check_forum_requirements(bot, chat_id)
285-
)
286-
if not is_ok:
287-
asyncio.run(bot.send_message(chat_id=chat_id, text=error_msg))
288-
_send_metric('TopicPrecheck.Failed')
283+
284+
async def _run_topic_precheck():
285+
is_ok, error_msg = await _check_forum_requirements(bot, chat_id)
286+
if not is_ok:
287+
await bot.send_message(chat_id=chat_id, text=error_msg)
288+
logger.warning(
289+
"Forum requirements check failed",
290+
extra={'chat_id': chat_id, 'error_msg': error_msg},
291+
)
292+
_send_metric('TopicPrecheck.Failed')
293+
294+
asyncio.run(_run_topic_precheck())
289295
return {'statusCode': 200}
290296

291297
message = update.message or update.edited_message

0 commit comments

Comments
 (0)