I'm trying to build a custom health check notification method. There is some documentation available here which is fine, but not ported for Umbraco 8 (as it is stated in the doc). I'm looking at EmailNotificationMethod and trying to do something similar. I have a very simple notification method:
[HealthCheckNotificationMethod("minimal")]
public class MinimalNotificationMethod : NotificationMethodBase
{
public MinimalNotificationMethod()
{
}
public override async Task SendAsync(HealthCheckResults results, CancellationToken token)
{
}
}
And I'm configuring it in the HealthChecks.config file:
I managed to find out what is going on here. For future questions around the same topic, here's the explanation.
The issue is caused by two different things.
The documentation states that If firstRunTime is empty, the tests will run for the first time right after the application is started.. I read this as if the check would run a few seconds after the startup of the application. In reality, there's a timeout period of 180.000 ms (3 minutes) before automatic health checks are run the first time.
For some reason my site was marked with ServerRole.Unknown. Health checks are not automatically executed if server role is unknown (or replica). When launching my project now, the server role is Single and the publisher is executed. I don't know enough about this to say why it was marked as Unknown in the first place.
Building custom health check notification methods
I'm trying to build a custom health check notification method. There is some documentation available here which is fine, but not ported for Umbraco 8 (as it is stated in the doc). I'm looking at EmailNotificationMethod and trying to do something similar. I have a very simple notification method:
And I'm configuring it in the
HealthChecks.config
file:(don't really want the email method in there, but Umbraco crashes if not there why I disabled it)
When starting the site, the debugger breaks inside the constructor of
MinimalNotificationMethod
. But it never breaks inside theSendAsync
method.I have set
umbracoApplicationUrl
tohttps://localhost:44327/umbraco/
in theumbracoSettings.config
file as stated in the docs.I'm on Umbraco 8.3 but I had the same problem in 8.0. What could be the problem here?
I managed to find out what is going on here. For future questions around the same topic, here's the explanation.
The issue is caused by two different things.
The documentation states that
If firstRunTime is empty, the tests will run for the first time right after the application is started.
. I read this as if the check would run a few seconds after the startup of the application. In reality, there's a timeout period of 180.000 ms (3 minutes) before automatic health checks are run the first time.For some reason my site was marked with
ServerRole.Unknown
. Health checks are not automatically executed if server role is unknown (or replica). When launching my project now, the server role isSingle
and the publisher is executed. I don't know enough about this to say why it was marked asUnknown
in the first place.is working on a reply...