fix: fixed migration by lazy load of rabbitmq
This commit is contained in:
parent
17cec6dd64
commit
176cf194cd
@ -22,18 +22,22 @@ public class Startup(IConfiguration configuration)
|
|||||||
services.AddDbContext<AppDbContext>(options =>
|
services.AddDbContext<AppDbContext>(options =>
|
||||||
options.UseNpgsql(Configuration.GetConnectionString("PostgreSQL")));
|
options.UseNpgsql(Configuration.GetConnectionString("PostgreSQL")));
|
||||||
|
|
||||||
var rabbitMqConnection = new ConnectionFactory
|
|
||||||
|
services.AddSingleton<IChannel>(x =>
|
||||||
{
|
{
|
||||||
HostName = "rabbitmq"
|
var rabbitMqConnection = new ConnectionFactory
|
||||||
}.CreateConnectionAsync().Result;
|
{
|
||||||
var channel = rabbitMqConnection.CreateChannelAsync().Result;
|
HostName = "rabbitmq"
|
||||||
channel.QueueDeclareAsync(
|
}.CreateConnectionAsync().Result;
|
||||||
RabbitQueues.AuthQueue,
|
var channel = rabbitMqConnection.CreateChannelAsync().Result;
|
||||||
false,
|
channel.QueueDeclareAsync(
|
||||||
false,
|
RabbitQueues.AuthQueue,
|
||||||
false,
|
false,
|
||||||
arguments: null).Wait();
|
false,
|
||||||
services.AddSingleton(channel);
|
false,
|
||||||
|
arguments: null).Wait();
|
||||||
|
return channel;
|
||||||
|
});
|
||||||
|
|
||||||
services.Configure<HeadHunterConfig>(Configuration.GetSection(HeadHunterConfig.SectionName));
|
services.Configure<HeadHunterConfig>(Configuration.GetSection(HeadHunterConfig.SectionName));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user