A callback-based heartbeat handler
sprockets.handlers.heartbeat
is available on the
Python Package Index
and can be installed via pip
or easy_install
:
pip install sprockets.handlers.heartbeat
https://sprocketshandlersheartbeat.readthedocs.org
This examples demonstrates how to use sprockets.handlers.heartbeat
by
registering the check_database
method that is invoked each time a request
to /heartbeat
is made.
from sprockets.handlers import heartbeat
from tornado import web
def check_database():
"""Any check method should return a bool specifying the check is ok.
:rtype: bool
"""
return True
# Register the check method
heartbeat.register_callback(check_database)
# Create a Tornado application
app = web.Application([('/heartbeat', heartbeat.HeartbeatHandler)])
Available at https://sprocketshandlersheartbeat.readthedocs.org/en/latest/history.html