classtranscribe / classtranscribe/WebAPI
Address RabbitMQ Lifecycline in webapi container
- Dominant language
- C#
- Stars
- 16
- Forks
- 4
- PR merge metrics
- No merged PRs in 30d
Description
api | 2020-10-05T04:06:26.418637135Z fail: Microsoft.AspNetCore.Server.Kestrel[13]
api | 2020-10-05T04:06:26.418861157Z Connection id "0HM38OS2JSBOO", Request id "0HM38OS2JSBOO:0000001D": An unhandled exception was thrown by the application.
api | 2020-10-05T04:06:26.419017747Z System.NullReferenceException: Object reference not set to an instance of an object.
api | 2020-10-05T04:06:26.419062795Z at CTCommons.RabbitMQConnection.Dispose(Boolean disposing) in /src/CTCommons/RabbitMQ/RabbitMQConnection.cs:line 268
api | 2020-10-05T04:06:26.419091515Z at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.DisposeAsync()
api | 2020-10-05T04:06:26.419118001Z --- End of stack trace from previous location where exception was thrown ---
api | 2020-10-05T04:06:26.419145603Z at Microsoft.AspNetCore.Http.Features.RequestServicesFeature.g__Awaited|9_0(RequestServicesFeature servicesFeature, ValueTask vt)
api | 2020-10-05T04:06:26.419251537Z at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.FireOnCompletedAwaited(Task currentTask, Stack`1 onCompleted)
Line 268 is the closing brace of virtual void Dispose(bool disposing)
---
The current code discards the connection and channel every time we dispose of this object.
We should at least persist the connection over the lifetime of the application, and probably the channel too. Should we make this object a Singleton defined using DependencyInjection?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.