Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
TakeStock
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
pengjinyang
TakeStock
Commits
a75e6e3f
Commit
a75e6e3f
authored
Jan 06, 2020
by
pengjinyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
f6b3f0c7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
+8
-7
Startup.cs
TakeStock.API/Startup.cs
+8
-7
No files found.
TakeStock.API/Startup.cs
View file @
a75e6e3f
...
@@ -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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment