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 {
|
||||
var ok bool
|
||||
if _, ok = state.peers[peerID]; !ok {
|
||||
log.Printf("peer not found: %s\n", peerID)
|
||||
return fmt.Errorf("peer not found: %s", peerID)
|
||||
log.Printf("peer not found: req=%s peer=%s\n", reqID, peerID)
|
||||
return fmt.Errorf("peer not found: req=%s peer=%s", reqID, peerID)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
@ -450,8 +450,8 @@ func (s *service) postResult(w http.ResponseWriter, r *http.Request, reqID strin
|
|||
peerResults := &PeerResults{}
|
||||
peerResults.SetStreamID(aggPeer(peerID))
|
||||
err = s.es.Load(ctx, peerResults)
|
||||
if err != nil {
|
||||
span.RecordError(fmt.Errorf("peer not found: %w", err))
|
||||
if err != nil && !errors.Is(err, ev.ErrNotFound) {
|
||||
span.RecordError(fmt.Errorf("peer not found: req=%s peer=%s %w", reqID, peerID, err))
|
||||
w.WriteHeader(http.StatusNotFound)
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user