From ba77d7b70616152627882127f8576d2ccce722ef Mon Sep 17 00:00:00 2001 From: Aimeast Date: Tue, 9 Jun 2015 00:00:59 +0800 Subject: [PATCH] some fix and improve fix schedule repeat executing decrease the interval of log timer allow anonymous to access about page --- GitCandy/Controllers/HomeController.cs | 1 + GitCandy/Log/Logger.cs | 4 ++-- GitCandy/Schedules/Runner.cs | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/GitCandy/Controllers/HomeController.cs b/GitCandy/Controllers/HomeController.cs index 131ff76..da39b0c 100644 --- a/GitCandy/Controllers/HomeController.cs +++ b/GitCandy/Controllers/HomeController.cs @@ -12,6 +12,7 @@ namespace GitCandy.Controllers return RedirectToStartPage(); } + [AllowAnonymous] public ActionResult About() { return View(); diff --git a/GitCandy/Log/Logger.cs b/GitCandy/Log/Logger.cs index 4a68dad..81ceb56 100644 --- a/GitCandy/Log/Logger.cs +++ b/GitCandy/Log/Logger.cs @@ -24,7 +24,7 @@ namespace GitCandy.Log Contract.Requires(logPath != null); LogFilePath = logPath; - _timer = new Timer(o => DisposeWriter(false), null, TimeSpan.FromSeconds(1.0), TimeSpan.FromSeconds(1.0)); + _timer = new Timer(o => DisposeWriter(false), null, TimeSpan.FromSeconds(0.1), TimeSpan.FromSeconds(0.1)); } public string LogFilePath { get; private set; } @@ -50,7 +50,7 @@ namespace GitCandy.Log { if (_writer != null) lock (_instanceSyncRoot) - if (_writer != null && (force || _utcLastWrite.AddSeconds(1.0) < DateTime.UtcNow)) + if (_writer != null && (force || _utcLastWrite.AddSeconds(0.2) < DateTime.UtcNow)) { _writer.Flush(); _writer.Dispose(); diff --git a/GitCandy/Schedules/Runner.cs b/GitCandy/Schedules/Runner.cs index 7b40fc2..a81de25 100644 --- a/GitCandy/Schedules/Runner.cs +++ b/GitCandy/Schedules/Runner.cs @@ -76,9 +76,9 @@ namespace GitCandy.Schedules context.UtcStart = utcStart; context.OnExecuting(this, context); + context.ExecutionTimes++; Logger.Info("Job {0} executing on runner #{1}", jobName, ID); context.Job.Execute(context); - context.ExecutionTimes++; context.UtcLastEnd = DateTime.UtcNow; context.UtcLastStart = utcStart; context.UtcStart = null;