Skip to content

Commit

Permalink
Remove /health endpoint to check server health.
Browse files Browse the repository at this point in the history
  • Loading branch information
SeoulSKY committed Jun 28, 2024
1 parent fc09b96 commit 68a7a5c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
2 changes: 1 addition & 1 deletion examples/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def main():
"""

logger = logging.getLogger(__name__)
notifier = YouTubeNotifier(callback_url="https://886a-2604-3d09-e074-e700-81a2-2a9f-2e54-8395.ngrok-free.app")
notifier = YouTubeNotifier()

@notifier.any()
async def listener1(notification: Notification):
Expand Down
13 changes: 3 additions & 10 deletions ytnoti/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import asyncio
import logging
import random
import socket
import string
import time
from collections import OrderedDict
Expand Down Expand Up @@ -302,8 +303,7 @@ def _get_router(self) -> APIRouter:
"""

router = APIRouter()
router.add_api_route(urljoin(self._config.endpoint, "health"), self._health, methods=["HEAD", "GET"])
router.add_api_route(self._config.endpoint, self._get, methods=["GET"])
router.add_api_route(self._config.endpoint, self._get, methods=["HEAD", "GET"])
router.add_api_route(self._config.endpoint, self._post, methods=["POST"])

return router
Expand Down Expand Up @@ -429,7 +429,7 @@ async def _is_listening(self) -> bool:

try:
async with AsyncClient() as client:
response = await client.head(urljoin(self._config.callback_url, "health"))
response = await client.head(self._config.callback_url, params={"hub.challenge": "1"})
except ConnectionError:
return False

Expand Down Expand Up @@ -473,13 +473,6 @@ async def _subscribe(self, channel_ids: Iterable[str], *, mode: Literal["subscri

self._logger.info("Successfully %sd channel: %s", mode, channel_id)

@staticmethod
async def _health():
"""
Health check endpoint.
"""
return Response()

@staticmethod
async def _get(request: Request):
"""
Expand Down

0 comments on commit 68a7a5c

Please sign in to comment.