MCPcopy Create free account
hub / github.com/openai/openai-agents-python / ping_with_retry

Function ping_with_retry

examples/memory/dapr_session_example.py:87–99  ·  view source on GitHub ↗

Retry session.ping() until success or timeout.

(
    session: DaprSession, timeout_seconds: float = 5.0, interval_seconds: float = 0.5
)

Source from the content-addressed store, hash-verified

85
86
87async def ping_with_retry(
88 session: DaprSession, timeout_seconds: float = 5.0, interval_seconds: float = 0.5
89) -> bool:
90 """Retry session.ping() until success or timeout."""
91 now = asyncio.get_running_loop().time
92 deadline = now() + timeout_seconds
93 while True:
94 if await session.ping():
95 return True
96 print("Dapr sidecar is not available! Retrying...")
97 if now() >= deadline:
98 return False
99 await asyncio.sleep(interval_seconds)
100
101
102async def main():

Callers 2

mainFunction · 0.85
demonstrate_multi_storeFunction · 0.85

Calls 1

pingMethod · 0.45

Tested by

no test coverage detected