mirror of
https://github.com/thatmattlove/hyperglass.git
synced 2026-01-17 08:48:05 +00:00
16 lines
371 B
Python
16 lines
371 B
Python
"""API Events."""
|
|
|
|
# Project
|
|
from hyperglass.cache import AsyncCache
|
|
from hyperglass.configuration import REDIS_CONFIG, params
|
|
|
|
|
|
async def check_redis() -> bool:
|
|
"""Ensure Redis is running before starting server."""
|
|
cache = AsyncCache(db=params.cache.database, **REDIS_CONFIG)
|
|
await cache.test()
|
|
return True
|
|
|
|
|
|
on_startup = (check_redis,)
|
|
on_shutdown = ()
|