fix(email sending): guidance for use of exchange

This commit is contained in:
YuehuCao 2025-08-15 00:23:22 +08:00
parent 59e8c06078
commit 5b727cb51c
2 changed files with 10 additions and 2 deletions

View File

@ -8,7 +8,8 @@ import aio_pika
class AsyncMQClient: class AsyncMQClient:
# TODO: change to freeleaps.notification.exchange.{} # TODO: change to freeleaps.notification.exchange.{}
# in local test, we use freeleaps.notification.exchange.local.{} to avoid repeating sending emails # in local test, we use freeleaps.notification.exchange.local.{} to avoid repeating sending emails
exchange_name_format = "freeleaps.notification.exchange.local.{}" #exchange_name_format = "freeleaps.notification.exchange.local.{}"
exchange_name_format = "freeleaps.notification.exchange.{}"
exchange_type = "direct" exchange_type = "direct"
def __init__(self, channel_name: str) -> None: def __init__(self, channel_name: str) -> None:

View File

@ -33,4 +33,11 @@ tenant_notification.py
```shell ```shell
# run the command # run the command
python test_tenant_notification_real.py python test_tenant_notification_real.py
``` ```
After running the commands, email will be sent
## Q & A
### Q: Why is the email sent twice?
### Q: Why do I recieve 2 identical emails at the same time
### A: in infra/rabbitmq/async_client.py, use exchange_name_format = "freeleaps.notification.exchange.local.{}" for local environment, while exchange_name_format = "freeleaps.notification.exchange.{}" for alpha environment.