Insert in tx #51
2 changed files with 6 additions and 5 deletions
|
@ -11,6 +11,7 @@ import (
|
|||
"math/big"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/lbryio/reflector.go/internal/metrics"
|
||||
|
@ -70,11 +71,10 @@ func (s *Server) Start(address string) error {
|
|||
}
|
||||
r := mux.NewRouter()
|
||||
r.HandleFunc("/get/{hash}", func(w http.ResponseWriter, r *http.Request) {
|
||||
waiter := stop.New()
|
||||
waiter := &sync.WaitGroup{}
|
||||
waiter.Add(1)
|
||||
enqueue(&blobRequest{request: r, reply: w, finished: waiter})
|
||||
select {
|
||||
case <-waiter.Ch():
|
||||
}
|
||||
waiter.Wait()
|
||||
})
|
||||
r.HandleFunc("/has/{hash}", func(w http.ResponseWriter, r *http.Request) {
|
||||
vars := mux.Vars(r)
|
||||
|
|
|
@ -2,6 +2,7 @@ package http3
|
|||
|
||||
import (
|
||||
"net/http"
|
||||
"sync"
|
||||
|
||||
"github.com/lbryio/reflector.go/internal/metrics"
|
||||
|
||||
|
@ -11,7 +12,7 @@ import (
|
|||
type blobRequest struct {
|
||||
request *http.Request
|
||||
reply http.ResponseWriter
|
||||
finished *stop.Group
|
||||
finished *sync.WaitGroup
|
||||
}
|
||||
|
||||
var getReqCh = make(chan *blobRequest)
|
||||
|
|
Loading…
Reference in a new issue