Closed
Description
Currently a new gRPC connection to lnd is created for every request.
It should be possible to create the gRPC connection only once when one of the middlewares is created, for example when NewHandlerFuncMiddleware(...)
is called, but before the handler func is returned.
func createHandlerFunc(invoiceOptions InvoiceOptions, lndOptions LNDoptions, storageClient StorageClient, next http.HandlerFunc) func(w http.ResponseWriter, r *http.Request) {
// <---- create the gRPC connection here and reuse it within the below func
return func(w http.ResponseWriter, r *http.Request) {
Care must be taken regarding connections that are aborted/lost/..., for example due to a network error. Is it possible to reconnect with the existing connection object/ref?
Activity