Checks if node should retry and sleeps if so.
(
self, e: Exception, ctx: Context, attempt_count: int
)
| 170 | attempt_count += 1 |
| 171 | |
| 172 | async def _attempt_retry( |
| 173 | self, e: Exception, ctx: Context, attempt_count: int |
| 174 | ) -> bool: |
| 175 | """Checks if node should retry and sleeps if so.""" |
| 176 | from ._node_state import NodeState |
| 177 | from .utils._retry_utils import _get_retry_delay |
| 178 | from .utils._retry_utils import _should_retry_node |
| 179 | |
| 180 | node_state = NodeState(attempt_count=attempt_count) |
| 181 | |
| 182 | if not _should_retry_node(e, self._node.retry_config, node_state): |
| 183 | return False |
| 184 | |
| 185 | delay = _get_retry_delay(self._node.retry_config, node_state) |
| 186 | |
| 187 | await asyncio.sleep(delay) |
| 188 | return True |
| 189 | |
| 190 | def _create_child_context( |
| 191 | self, |
no test coverage detected