I am building a microservices application using ASP.NET Core 10, RabbitMQ, Docker and a Python worker service.
The API sends a search request to RabbitMQ and waits for the worker response.
Initially everything works correctly, but after several requests some HTTP requests stay in Pending state forever and never return a response.
My RabbitMQ services were registered as Scoped:
builder.Services.AddScoped
builder.Services.AddScoped
builder.Services.AddScoped
The strange thing is that the first several requests work correctly, but after some requests it gets into pending state , but sometimes it happens not all the time.
I searched and got that connection to RabbitMQ must be singleton but ,
My question's:
Why sometimes it gets into pending and sometimes it works properly?