提交 2b545fbe 编写于 作者: 麦壳饼's avatar 麦壳饼

加入更多配置使得可以调整连接池

上级 d15f4074
......@@ -61,7 +61,8 @@ namespace IoTSharp
public ShardingSetting Sharding { get; set; } = new ShardingSetting();
public EventBusStore EventBusStore { get; set; } = EventBusStore.InMemory;
public EventBusMQ EventBusMQ { get; set; } = EventBusMQ.InMemory;
public int ConsumerThreadCount { get; set; }
public int ConsumerThreadCount { get; set; } = Environment.ProcessorCount;
public int DbContextPoolSize { get; set; } = 128;
}
public class ShardingSetting
......
......@@ -73,7 +73,7 @@ namespace IoTSharp
setting.MqttBroker = settings.MqttBroker;
setting.MqttClient = settings.MqttClient;
}));
services.AddDbContextPool<ApplicationDbContext>(options => options.UseNpgsql(Configuration.GetConnectionString("IoTSharp")) , poolSize:2048 );
services.AddDbContextPool<ApplicationDbContext>(options => options.UseNpgsql(Configuration.GetConnectionString("IoTSharp")) , poolSize: settings.DbContextPoolSize);
services.AddIdentity<IdentityUser, IdentityRole>()
.AddRoles<IdentityRole>()
.AddRoleManager<RoleManager<IdentityRole>>()
......@@ -188,7 +188,7 @@ namespace IoTSharp
services.AddCap(x =>
{
x.ConsumerThreadCount = settings.ConsumerThreadCount <=0? Environment.ProcessorCount: settings.ConsumerThreadCount;
x.ConsumerThreadCount = settings.ConsumerThreadCount ;
switch (settings.EventBusStore)
{
case EventBusStore.PostgreSql:
......@@ -237,7 +237,7 @@ namespace IoTSharp
// Register Dashboard
x.UseDashboard();
// Register to Consul
x.UseDiscovery();
//x.UseDiscovery();
});
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册