Skip to content

Commit

Permalink
Remove Logs For Missed Ticks (#392)
Browse files Browse the repository at this point in the history
* remove logs for missed ticks

* update csproj
  • Loading branch information
jamesmh authored Jun 20, 2024
1 parent 785fe1f commit e136cd9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 21 deletions.
27 changes: 9 additions & 18 deletions Demo/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,26 +95,17 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env)
.Schedule<RebuildStaticCachedData>().Hourly();

scheduler.OnWorker("TestingSeconds");
// scheduler.Schedule(
// () => Console.WriteLine($"Runs every second. Ran at: {DateTime.UtcNow}")
// ).EverySecond();
// scheduler.Schedule(() => Console.WriteLine($"Runs every thirty seconds. Ran at: {DateTime.UtcNow}")).EveryThirtySeconds().Zoned(TimeZoneInfo.Local);
// scheduler.Schedule(() => Console.WriteLine($"Runs every ten seconds. Ran at: {DateTime.UtcNow}")).EveryTenSeconds();
// scheduler.Schedule(() => Console.WriteLine($"Runs every fifteen seconds. Ran at: {DateTime.UtcNow}")).EveryFifteenSeconds();
// scheduler.Schedule(() => Console.WriteLine($"Runs every thirty seconds. Ran at: {DateTime.UtcNow}")).EveryThirtySeconds();
// scheduler.Schedule(() => Console.WriteLine($"Runs every minute Ran at: {DateTime.UtcNow}")).EveryMinute();
// scheduler.Schedule(() => Console.WriteLine($"Runs every 2nd minute Ran at: {DateTime.UtcNow}")).Cron("*/2 * * * *");
scheduler.Schedule(
() => Console.WriteLine($"Runs every second. Ran at: {DateTime.UtcNow}")
).EverySecond();
scheduler.Schedule(() => Console.WriteLine($"Runs every thirty seconds. Ran at: {DateTime.UtcNow}")).EveryThirtySeconds().Zoned(TimeZoneInfo.Local);
scheduler.Schedule(() => Console.WriteLine($"Runs every ten seconds. Ran at: {DateTime.UtcNow}")).EveryTenSeconds();
scheduler.Schedule(() => Console.WriteLine($"Runs every fifteen seconds. Ran at: {DateTime.UtcNow}")).EveryFifteenSeconds();
scheduler.Schedule(() => Console.WriteLine($"Runs every thirty seconds. Ran at: {DateTime.UtcNow}")).EveryThirtySeconds();
scheduler.Schedule(() => Console.WriteLine($"Runs every minute Ran at: {DateTime.UtcNow}")).EveryMinute();
scheduler.Schedule(() => Console.WriteLine($"Runs every 2nd minute Ran at: {DateTime.UtcNow}")).Cron("*/2 * * * *");


scheduler.Schedule(() => Thread.Sleep(5000)).EverySecond();
scheduler.Schedule(() => Thread.Sleep(5000)).EverySecond();
scheduler.Schedule(() => Thread.Sleep(5000)).EverySecond();
scheduler.Schedule(() => Thread.Sleep(5000)).EverySecond();
scheduler.Schedule(() => Thread.Sleep(5000)).EverySecond();
scheduler.Schedule(() => Thread.Sleep(5000)).EverySecond();
scheduler.Schedule(() => Thread.Sleep(5000)).EverySecond();
scheduler.Schedule(() => Thread.Sleep(5000)).EverySecond();
scheduler.Schedule(() => Thread.Sleep(5000)).EverySecond();
scheduler.Schedule(() => Thread.Sleep(5000)).EverySecond();
});

Expand Down
2 changes: 1 addition & 1 deletion Src/Coravel/Coravel.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFramework>.net6.0</TargetFramework>
<PackageId>Coravel</PackageId>
<Version>5.0.3</Version>
<Version>5.0.4</Version>
<Authors>James Hickey</Authors>
<Company>-</Company>
<Title>Coravel</Title>
Expand Down
3 changes: 1 addition & 2 deletions Src/Coravel/Scheduling/HostedService/SchedulerHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ private async void RunSchedulerPerSecondAsync(object state)
}

if (ticks.Length > 0)
{
this._logger.LogInformation($"Coravel's scheduler is behind {ticks.Length} ticks and is catching-up to the current tick. Triggered at {now.ToString("o")}.");
{
foreach (var tick in ticks)
{
await this._scheduler.RunAtAsync(tick);
Expand Down

0 comments on commit e136cd9

Please sign in to comment.