Commit a75e6e3f by pengjinyang

no message

parent f6b3f0c7
...@@ -33,11 +33,11 @@ namespace TakeStock.API ...@@ -33,11 +33,11 @@ namespace TakeStock.API
public Startup(IConfiguration configuration) public Startup(IConfiguration configuration)
{ {
Configuration = configuration; Configuration = configuration;
//Redis = ConnectionMultiplexer.Connect(Configuration.GetConnectionString("Redis")); Redis = ConnectionMultiplexer.Connect(Configuration.GetConnectionString("Redis"));
} }
public IConfiguration Configuration { get; } public IConfiguration Configuration { get; }
//public static ConnectionMultiplexer Redis; public static ConnectionMultiplexer Redis;
// This method gets called by the runtime. Use this method to add services to the container. // This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services) public void ConfigureServices(IServiceCollection services)
...@@ -74,10 +74,11 @@ namespace TakeStock.API ...@@ -74,10 +74,11 @@ namespace TakeStock.API
services.AddHttpClient(); services.AddHttpClient();
// Add Hangfire services. // Add Hangfire services.
services.AddHangfire(config => //services.AddHangfire(config =>
{ //{
config.UseMemoryStorage(); // config.UseMemoryStorage();
}); //});
services.AddHangfire(configuration => configuration.UseRedisStorage(Redis));
// Add the processing server as IHostedService // Add the processing server as IHostedService
services.AddHangfireServer(); services.AddHangfireServer();
...@@ -106,7 +107,7 @@ namespace TakeStock.API ...@@ -106,7 +107,7 @@ namespace TakeStock.API
app.UseHangfireDashboard("/hangfire", options); app.UseHangfireDashboard("/hangfire", options);
var options2 = new BackgroundJobServerOptions var options2 = new BackgroundJobServerOptions
{ {
WorkerCount = Environment.ProcessorCount * 5, WorkerCount = Environment.ProcessorCount * 10,
Queues = new[] { "freezestock", "rollbackstock", "syncandenabledstock", "checkcomplete", "modifandenabledstock", "canceltakestock", "default" } Queues = new[] { "freezestock", "rollbackstock", "syncandenabledstock", "checkcomplete", "modifandenabledstock", "canceltakestock", "default" }
}; };
app.UseHangfireServer(options2); app.UseHangfireServer(options2);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment