Skip to content

Commit

Permalink
Only warn instead of an exception
Browse files Browse the repository at this point in the history
  • Loading branch information
linkdotnet committed Nov 2, 2024
1 parent 9c8baa8 commit 9509aaa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
3 changes: 3 additions & 0 deletions src/NCronJob/Scheduler/QueueWorker.LogMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,7 @@ internal sealed partial class QueueWorker

[LoggerMessage(LogLevel.Information, "Job removed from queue: {JobType} at {RunAt}")]
private partial void LogJobRemovedFromQueue(string jobType, DateTime? runAt);

[LoggerMessage(LogLevel.Warning, "The UseNCronJob(Async) method was not called. Startup jobs did might not be executed.")]
private partial void LogUseNCronJobNotCalled();
}
5 changes: 1 addition & 4 deletions src/NCronJob/Scheduler/QueueWorker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,7 @@ private void AssertUseNCronJobWasCalled()
{
if (!missingMethodCalledHandler.UseWasCalled)
{
throw new InvalidOperationException("""
UseNCronJob(Async) was not called on the host.
Make sure to call app.UseNCronJob() (or await app.UseNCronJobAsync()) in your Program.cs.
""");
LogUseNCronJobNotCalled();
}
}

Expand Down

0 comments on commit 9509aaa

Please sign in to comment.