sendalerts.py 文件源码

python
阅读 17 收藏 0 点赞 0 评论 0

项目:healthchecks_asgards 作者: andela 项目源码 文件源码
def handle_one(self, check):
        """ Send an alert for a single check.

        Return True if an appropriate check was selected and processed.
        Return False if no checks need to be processed.

        """

        # Save the new status. If sendalerts crashes,
        # it won't process this check again.
        check.status = check.get_status()
        check.save()

        tmpl = "\nSending alert, status=%s, code=%s\n"
        self.stdout.write(tmpl % (check.status, check.code))
        errors = check.send_alert()
        for ch, error in errors:
            self.stdout.write("ERROR: %s %s %s\n" % (ch.kind, ch.value, error))

        connection.close()
        return True
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号