mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-07-13 06:32:30 +02:00
lntest: do not do IO under mutex in fee_service
If HTTP response is consumed slowly, this might block other HTTP requests to the fee service, because the mutex is held.
This commit is contained in:
@ -115,14 +115,13 @@ func (f *FeeService) Start() error {
|
||||
// handleRequest handles a client request for fee estimates.
|
||||
func (f *FeeService) handleRequest(w http.ResponseWriter, _ *http.Request) {
|
||||
f.lock.Lock()
|
||||
defer f.lock.Unlock()
|
||||
|
||||
bytes, err := json.Marshal(
|
||||
chainfee.WebAPIResponse{
|
||||
FeeByBlockTarget: f.feeRateMap,
|
||||
MinRelayFeerate: f.minRelayFeerate,
|
||||
},
|
||||
)
|
||||
f.lock.Unlock()
|
||||
require.NoErrorf(f, err, "cannot serialize estimates")
|
||||
|
||||
_, err = io.WriteString(w, string(bytes))
|
||||
|
Reference in New Issue
Block a user