aboutsummaryrefslogtreecommitdiff
path: root/Main/Startup.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Main/Startup.cs')
-rw-r--r--Main/Startup.cs9
1 files changed, 4 insertions, 5 deletions
diff --git a/Main/Startup.cs b/Main/Startup.cs
index 980e110..c077b6b 100644
--- a/Main/Startup.cs
+++ b/Main/Startup.cs
@@ -32,11 +32,13 @@ namespace Main {
options.UseMySQL(Configuration.GetConnectionString("Storage"));
});
+ services.AddScoped<IAggregatorJob, AggregatorJob>();
+
services.AddHangfire(options => options.UseStorage(new MySqlStorage(Configuration.GetConnectionString("Storage"))));
services.AddDirectoryBrowser();
}
- public void Configure(IApplicationBuilder app, IHostingEnvironment env) {
+ public void Configure(IApplicationBuilder app, IHostingEnvironment env, IAggregatorJob aggregator) {
if (env.IsDevelopment()) {
app.UseDeveloperExceptionPage();
}
@@ -51,10 +53,7 @@ namespace Main {
app.UseHangfireServer();
app.UseHangfireDashboard();
- RecurringJob.AddOrUpdate<AggregatorJob>(
- x => x.Start(Configuration.GetConnectionString("Aggregator")),
- Cron.HourInterval(3)
- );
+ RecurringJob.AddOrUpdate("aggregator", () => aggregator.Start(), Cron.HourInterval(3));
}
}
}