aboutsummaryrefslogtreecommitdiff
path: root/modules/healthcheck.py
blob: 3b5acfe2889a148f0cd30d11281bc4dddd7031db (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#--require-config healthcheck-url

from src import ModuleManager, utils

# this module was created for use with https://healthchecks.io/
# but it can be used for any similar URL-pinging service.

class Module(ModuleManager.BaseModule):
    @utils.hook("cron")
    @utils.kwarg("schedule", "*/10")
    def ten_minutes(self, event):
        url = self.bot.config["healthcheck-url"]
        try:
            utils.http.request(url)
        except Exception as e:
            self.log.error("Failed to cal healthcheck-url (%s)", [url],
                exc_info=True)