Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
performance
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zry
performance
Commits
830d4b1e
Commit
830d4b1e
authored
Jun 22, 2021
by
lcx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
定时任务修复
parent
3faf6d78
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
1 deletions
+32
-1
performance/Performance.Api/Configurations/FluentSchedulerConfig.cs
+28
-0
performance/Performance.Api/Job/JobRegistry.cs
+1
-1
performance/Performance.Api/Startup.cs
+3
-0
No files found.
performance/Performance.Api/Configurations/FluentSchedulerConfig.cs
0 → 100644
View file @
830d4b1e
using
FluentScheduler
;
using
Microsoft.Extensions.DependencyInjection
;
using
Performance.Services
;
using
System
;
using
System.Linq
;
using
System.Reflection
;
namespace
Performance.Api.Configurations
{
public
static
class
FluentSchedulerConfig
{
public
static
void
AddFluentSchedulerConfiguration
(
this
IServiceCollection
services
)
{
if
(
services
==
null
)
throw
new
ArgumentNullException
(
nameof
(
services
));
ServiceLocator
.
Instance
=
services
.
BuildServiceProvider
();
JobManager
.
Initialize
(
new
JobRegistry
());
////扫描当前程序集中实现了Registry的类
//var registrys = Assembly.GetExecutingAssembly().GetTypes()
// .Where(t => !t.IsInterface && !t.IsSealed && !t.IsAbstract && typeof(Registry).IsAssignableFrom(t))
// .Select(s => s.Assembly.CreateInstance(s.FullName) as Registry)?.ToArray();
//// 注册同步服务
//JobManager.Initialize(registrys);
}
}
}
performance/Performance.Api/Job/JobRegistry.cs
View file @
830d4b1e
...
...
@@ -8,7 +8,7 @@ public JobRegistry()
{
//Schedule<ExtractDataJob>().ToRunNow().AndEvery(1).Days().At(23, 0);
//Schedule<ExtractDataJob>().ToRunEvery(1).Days().At(23, 0);
Schedule
<
ExtractGenerateJob
>().
ToRunEvery
(
1
).
Days
().
At
(
1
,
0
);
Schedule
<
ExtractGenerateJob
>().
ToRunEvery
(
1
).
Days
().
At
(
1
4
,
0
0
);
}
}
}
performance/Performance.Api/Startup.cs
View file @
830d4b1e
...
...
@@ -87,6 +87,9 @@ public void ConfigureServices(IServiceCollection services)
policy
.
SetIsOriginAllowed
(
origin
=>
true
).
AllowAnyHeader
().
AllowAnyMethod
().
AllowCredentials
();
});
});
// fluentscheduler
services
.
AddFluentSchedulerConfiguration
();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
...
...
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