fix: not allowing new peer results
This commit is contained in:
parent
87170420e4
commit
db72c24de3
|
@ -435,8 +435,8 @@ func (s *service) postResult(w http.ResponseWriter, r *http.Request, reqID strin
|
||||||
err := s.state.Use(ctx, func(ctx context.Context, state *state) error {
|
err := s.state.Use(ctx, func(ctx context.Context, state *state) error {
|
||||||
var ok bool
|
var ok bool
|
||||||
if _, ok = state.peers[peerID]; !ok {
|
if _, ok = state.peers[peerID]; !ok {
|
||||||
log.Printf("peer not found: %s\n", peerID)
|
log.Printf("peer not found: req=%s peer=%s\n", reqID, peerID)
|
||||||
return fmt.Errorf("peer not found: %s", peerID)
|
return fmt.Errorf("peer not found: req=%s peer=%s", reqID, peerID)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
@ -450,8 +450,8 @@ func (s *service) postResult(w http.ResponseWriter, r *http.Request, reqID strin
|
||||||
peerResults := &PeerResults{}
|
peerResults := &PeerResults{}
|
||||||
peerResults.SetStreamID(aggPeer(peerID))
|
peerResults.SetStreamID(aggPeer(peerID))
|
||||||
err = s.es.Load(ctx, peerResults)
|
err = s.es.Load(ctx, peerResults)
|
||||||
if err != nil {
|
if err != nil && !errors.Is(err, ev.ErrNotFound) {
|
||||||
span.RecordError(fmt.Errorf("peer not found: %w", err))
|
span.RecordError(fmt.Errorf("peer not found: req=%s peer=%s %w", reqID, peerID, err))
|
||||||
w.WriteHeader(http.StatusNotFound)
|
w.WriteHeader(http.StatusNotFound)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user