Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Patrick van Kemenade 101 posts 339 karma points
    Jun 14, 2020 @ 09:11
    Patrick van Kemenade
    0

    Health Check Sheduling, control if/when a health check gets run, error/missing info in Umbraco documentation

    I followed the tutorial about Health Checks and implemented the example of the check for the Robots.txt file. => https://our.umbraco.com/documentation/Extending/Health-Check/

    I did get some unexpected behaviour however not described in the manual.

    It seems that in the backed when you to the health check section, group SEO and perform all checks that it works.

    What I didn't know is when you don't go to health check the health check still seems to run periodically, I noticed this because I had a breakpoint in this code and was running in the backend with Debug enabled.

    This has some implications, for instance this line in the example is incorrect: var success = File.Exists(HttpContext.Current.Server.MapPath("~/robots.txt"));

    Because HttpContext.Current is null when it's run automatically.

    Also I was planning to create a health check on all pages to check for broken links, this will however require a lot of resources and should run attended because you want to see the list of pages with errors. It has to run attended in order to function properly. Also if you make an error in your health check wordt case scenario it can crash your website at a random time ?

    So my questions is basicly how to control it?

    And is there a way for me to fix this documentation, because it has to mention the automatic running of these custom health checkes.

    And there has to be a check for HttpContext.Current != null in the code sample.

  • Marc Goodson 2155 posts 14408 karma points MVP 9x c-trib
    Jun 15, 2020 @ 17:59
    Marc Goodson
    100

    Hi Patrick

    I think it's controllable from /config/healthchecks.config (which I think exists in both v7 and V8)

    There is a notifications entry:

     <notificationSettings enabled="true" firstRunTime="" periodInHours="24">
    

    which I think controls whether it runs on a schedule and 'how often' - so setting enabled="false" should turn it off...

    regards

    Marc

Please Sign in or register to post replies

Write your reply to:

Draft