Ejemplo n.º 1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, ITimeService feedService)
        {
            loggerFactory.AddFile("Logs/CMS-{Date}.txt");

            feedService.TimeIntervalHours = 1;
            Task.Run(async() =>
            {
                // updating existing feeds after 90 seconds
                await Task.Delay(1000 * 90);
                while (true)
                {
                    feedService.DoService();
                    await Task.Delay(feedService.TimeIntervalHours * 60 * 60 * 1000);
                }
            });


            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseMvc();
        }