Avoid connection-per-RPC-call again by caching connections
authorMatt Corallo <git@bluematt.me>
Thu, 30 Mar 2023 18:51:56 +0000 (18:51 +0000)
committerMatt Corallo <git@bluematt.me>
Thu, 30 Mar 2023 22:28:26 +0000 (22:28 +0000)
commit9a50e301cb149d25603767617fc41078e833bf58
treed099dbe1680767cafe9a8f3297127f730e200ce5
parent6b55df93fb60473349ec8a830c62a78a592729d2
Avoid connection-per-RPC-call again by caching connections

In general, only one request will be in flight at a time in
`lightning-block-sync`. Ideally we'd only have one connection, but
without using the `futures` mutex type.

Here we solve this narrowly for the one-request-at-a-time case by
caching the connection and takeing the connection out of the cache
while we work on it.
lightning-block-sync/src/rest.rs
lightning-block-sync/src/rpc.rs