pyvespa
pyvespa copied to clipboard
Switch Async HTTP-client to `httpx` (HTTP/2-support)
I confirm that this contribution is made under the terms of the license found in the root directory of this repository's source tree and that I have the authority necessary to make this contribution on behalf of its copyright owner.
- [x] Removed
@staticmethod
-decorator ofcallback_docv1
(See comment on bug below) - [x] Switched to httpx - Mainly to add HTTP/2 support, which presumably could improve feed performance by a lot.
- [x] Unit tests passing ✅ - BUT, working to quantify performance gain.
⚠️ Encountered this bug when tenacity retry is applied
self = <AsyncRetrying object at 0x10468fca0 (stop=<tenacity.stop.stop_after_attempt object at 0x10468fb20>, wait=<tenacity.wa...bject at 0x10468fac0>, before=<function before_nothing at 0x104463f70>, after=<function after_nothing at 0x10447b1f0>)>
retry_state = <RetryCallState 4369142976: attempt #3; slept for 3.0; last result: failed (TypeError object dict can't be used in 'await' expression)>
def iter(self, retry_state: "RetryCallState") -> t.Union[DoAttempt, DoSleep, t.Any]: # noqa
fut = retry_state.outcome
if fut is None:
if self.before is not None:
self.before(retry_state)
return DoAttempt()
is_explicit_retry = fut.failed and isinstance(fut.exception(), TryAgain)
if not (is_explicit_retry or self.retry(retry_state)):
return fut.result()
if self.after is not None:
self.after(retry_state)
self.statistics["delay_since_first_attempt"] = retry_state.seconds_since_start
if self.stop(retry_state):
if self.retry_error_callback:
> return self.retry_error_callback(retry_state)
E TypeError: 'staticmethod' object is not callable
notebooks/lib/python3.9/site-packages/tenacity/__init__.py:322: TypeError
We should make unit tests for error handling. Maybe this is part of your fix?