Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions qstash/asyncio/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,20 @@ def __init__(

self.dlq = AsyncDlqApi(self.http)
"""Dlq (Dead Letter Queue) api."""

async def readiness(self) -> str:
"""
Checks if the QStash service is ready to accept requests.

This endpoint is commonly used in orchestration systems (like Kubernetes
readiness probes) to determine when a service is ready to receive traffic.

:return: "OK" if the service is ready
:raises QStashError: If the request fails
"""
result: str = await self.http.request(
path="/v2/readiness",
method="GET",
parse_response=False,
)
return result
17 changes: 17 additions & 0 deletions qstash/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,20 @@ def __init__(

self.dlq = DlqApi(self.http)
"""Dlq (Dead Letter Queue) api."""

def readiness(self) -> str:
"""
Checks if the QStash service is ready to accept requests.

This endpoint is commonly used in orchestration systems (like Kubernetes
readiness probes) to determine when a service is ready to receive traffic.

:return: "OK" if the service is ready
:raises QStashError: If the request fails
"""
result: str = self.http.request(
path="/v2/readiness",
method="GET",
parse_response=False,
)
return result
9 changes: 9 additions & 0 deletions tests/asyncio/test_readiness.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import pytest

from qstash import AsyncQStash


@pytest.mark.asyncio
async def test_readiness_async(async_client: AsyncQStash) -> None:
response = await async_client.readiness()
assert response == "OK"
6 changes: 6 additions & 0 deletions tests/test_readiness.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from qstash import QStash


def test_readiness(client: QStash) -> None:
response = client.readiness()
assert response == "OK"
Loading