question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

StartDelay option delays web application start and not just the scheduler

See original GitHub issue

Describe the bug

There’s possibly an issue with QuartzHostedServiceOptions.StartDelay option which was recently introduced in 3.3.3 (via #1166).

If this value is set, all IHostedServices after QuartzHostedService are delayed. In a typical Asp.Net Core application this will include the web host itself. I don’t think this is the desired result.

I looked at #1166 and saw that it ultimately is about awaiting QuartzScheduler.StartDelayed. I was surprised to learn that the implementation of StartDelayed is a Task.Delay followed by a Start. I was somehow expecting a regular start and then a delay in scheduling, if it makes sense.

I hope I can offer some critique of the current implementation of QuartzScheduler.StartDelayed. If it is the desired behavior then I think such api is redundant and leads to confusion. It’s redundant, because developers are perfectly capable of adding a delay on their own before calling Start. As to confusion, I think that the comment in #1166:

// when we need to init another IHostedServices first
options.StartDelay = TimeSpan.FromSeconds(10);

shows that the author of that PR made the same assumption I would make and thought that StartDelayed would return normally (quickly) and only somehow delay the scheduling (though that’s wrong thinking still as it’s prone to races; the correct approach would be to simply register other hosted services before Quartz)

Version used

3.3.3

To Reproduce

Expected behavior

StartDelay should not cause a delay in starting other hosted services.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:12 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
lahmacommented, Jan 19, 2022

No timeline at the moment, it takes some time to prepare and go trough release notes etc. It will be same kind of binary as in MyGet feed though (different version number of course).

1reaction
lahmacommented, Oct 1, 2021

Thanks for working on this!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do you delay the launch of an application in Windows ...
One of its improvements is to delay start a task. Simply set it to execute your 'apps' ON LOGON with different delays. ......
Read more >
Spring Scheduled task does not start on application startup
I have a @Scheduled task in my application which is setup using CRON and run every 4 hours. The problem I face is...
Read more >
Q&A: How Do I Delay the Start of my Windows Service?
Another option for delaying the start of a service is to mark it as dependent on another service. To explain, let's take two...
Read more >
Scheduler Endpoint (Trigger)
The amount of time to delay execution of the Scheduler for the first time after the application starts. This property uses the same...
Read more >
Setting Up the PeopleSoft Windows Service to Start an ...
It involves setting application server and Process Scheduler server domains to start as PeopleSoft Windows services. Expand all sections. Understanding ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found