Improve smartprotocol error handling and retries (#578)

* Improve smartprotocol error handling and retries

* Update after review

* Enum to IntEnum and SLEEP_SECONDS_AFTER_TIMEOUT
This commit is contained in:
sdb9696
2023-12-10 15:41:53 +00:00
committed by GitHub
parent a77af5fb3b
commit 2e6c41d039
7 changed files with 208 additions and 54 deletions

View File

@@ -315,11 +315,11 @@ class FakeSmartTransport(BaseTransport):
method = request_dict["method"]
params = request_dict["params"]
if method == "component_nego" or method[:4] == "get_":
return {"result": self.info[method]}
return {"result": self.info[method], "error_code": 0}
elif method[:4] == "set_":
target_method = f"get_{method[4:]}"
self.info[target_method].update(params)
return {"result": ""}
return {"error_code": 0}
async def close(self) -> None:
pass