Azure service bus sender connection lost after some time. #38970
Labels
Client
This issue points to a problem in the data-plane of the library.
customer-reported
Issues that are reported by GitHub users external to the Azure organization.
needs-team-attention
Workflow: This issue needs attention from Azure service team or SDK team
question
The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Service Bus
Describe the bug
I create an service bus client and senders for each queue on system start up.
after about 10 minutes of inactivity (No message sent from the client) the senders lose connection and the next send takes about 8 seconds.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
A connection is always established and a send operation does not take long time.
Attaching code:
`
import asyncio
import logging
import time
import uuid
from datetime import datetime
from azure.servicebus.aio import ServiceBusClient, ServiceBusSender
from azure.servicebus import ServiceBusMessage
from src.config import settings
from src.vendor.service_bus.consts import (
EMAIL_QUEUE,
SMS_QUEUE,
WEBHOOK_QUEUE,
)
log = logging.getLogger(name)
class ServiceBusService:
service_bus_service = ServiceBusService()
async def run_test():
t0 = time.perf_counter()
await service_bus_service.send_single_message("Test", WEBHOOK_QUEUE)
t1 = time.perf_counter()
print("time in seconds: ", t1 - t0)
if name == 'main':
asyncio.run(run_test())
`
first message took 1 second
second message 8 seconds.
The entire 8 seconds were taken from the "await sender.send_messages(sb_message)" call.
The text was updated successfully, but these errors were encountered: