예제 #1
0
 private static void AppStartBackGroundJob(IAdminSettingService adminservice, IMonitoringApi monitor)
 {
     PurgeJobs(monitor);
     RecurringJob.AddOrUpdate("GetSpojInfo", () => adminservice.GetSpojInfo(), "*/1 * * * *");
     RecurringJob.AddOrUpdate("DownloadSpojTestCases", () => adminservice.DownloadSpojTestCases(), "*/1 * * * *");
     RecurringJob.AddOrUpdate("GetSubmissionInfo", () => adminservice.GetSubmissionInfo(), "*/1 * * * *");
 }
 public AdminSettingController(IAdminSettingService adminSettingService,
                               IProblemService problemService,
                               ITestCaseService testCaseService)
 {
     _adminSettingService = adminSettingService;
     _problemService      = problemService;
     _testCaseService     = testCaseService;
 }
예제 #3
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app,
                              IHostingEnvironment env,
                              IAdminSettingService adminService,
                              ISeedDataService seedDataService,
                              SpojDebugDbContext dbContext)
        {
            dbContext.Database.Migrate();

            app.UseHangfireDashboard();
            app.UseHangfireServer();

            if (env.IsDevelopment())
            {
                app.UseBrowserLink();
                app.UseDeveloperExceptionPage();
                app.UseDatabaseErrorPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }

            app.UseStaticFiles();

            app.UseAuthentication();

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });
            var monitor = JobStorage.Current.GetMonitoringApi();

            seedDataService.InitData();
            AppStartBackGroundJob(adminService, monitor);
        }