Skip to content

Commit fc68869

Browse files
committed
docs(main): add TODO for decoupling webhook processing if scaling requires it
1 parent 12a1b3d commit fc68869

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

main.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,9 @@ async def telegram_webhook(token: str, request: Request):
119119
update = telegram.Update.de_json(data=data, bot=application.bot)
120120
# Await the processing SYNCHRONOUSLY before returning 200 OK
121121
# This prevents Cloud Run from throttling the CPU while the bot is doing work
122+
# TODO: If user traffic scales significantly and Telegram throws `RetryAfter` for
123+
# generic `send_message` calls, consider offloading processing or outbound
124+
# messages to Google Cloud Tasks / PubSub to decouple the HTTP response from the work.
122125
await application.process_update(update)
123126
except Exception as e:
124127
logging.error(f"Failed to process update: {e}")

0 commit comments

Comments
 (0)