Spark: increase timeout and improved error handling (#718)
* increase timeout and more error handling * more error handling * add timeout exception
This commit is contained in:
parent
41dda6fd01
commit
357860d849
|
@ -48,9 +48,16 @@ class SparkWallet(Wallet):
|
|||
self.url + "/rpc",
|
||||
headers={"X-Access": self.token},
|
||||
json={"method": key, "params": params},
|
||||
timeout=40,
|
||||
timeout=60 * 60 * 24,
|
||||
)
|
||||
except (OSError, httpx.ConnectError, httpx.RequestError) as exc:
|
||||
r.raise_for_status()
|
||||
except (
|
||||
OSError,
|
||||
httpx.ConnectError,
|
||||
httpx.RequestError,
|
||||
httpx.HTTPError,
|
||||
httpx.TimeoutException,
|
||||
) as exc:
|
||||
raise UnknownError("error connecting to spark: " + str(exc))
|
||||
|
||||
try:
|
||||
|
@ -203,7 +210,13 @@ class SparkWallet(Wallet):
|
|||
data = json.loads(line[5:])
|
||||
if "pay_index" in data and data.get("status") == "paid":
|
||||
yield data["label"]
|
||||
except (OSError, httpx.ReadError, httpx.ConnectError, httpx.ReadTimeout):
|
||||
except (
|
||||
OSError,
|
||||
httpx.ReadError,
|
||||
httpx.ConnectError,
|
||||
httpx.ReadTimeout,
|
||||
httpx.HTTPError,
|
||||
):
|
||||
pass
|
||||
|
||||
logger.error("lost connection to spark /stream, retrying in 5 seconds")
|
||||
|
|
Loading…
Reference in New Issue
Block a user