Skip to content

Commit

Permalink
Fix iterator error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
islamaliev committed Nov 5, 2024
1 parent 4ffbcb9 commit 21269c1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions internal/db/p2p_replicator.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ package db
import (
"context"
"encoding/json"
"errors"
"time"

"github.com/fxamacker/cbor/v2"
Expand All @@ -23,7 +24,7 @@ import (

"github.com/sourcenetwork/defradb/client"
"github.com/sourcenetwork/defradb/datastore"
"github.com/sourcenetwork/defradb/errors"
dbErrors "github.com/sourcenetwork/defradb/errors"
"github.com/sourcenetwork/defradb/event"
"github.com/sourcenetwork/defradb/internal/core"
"github.com/sourcenetwork/defradb/internal/keys"
Expand Down Expand Up @@ -162,7 +163,7 @@ func (db *db) getDocsHeads(
log.ErrorContextE(
ctx,
"Failed to get all docIDs",
NewErrReplicatorDocID(err, errors.NewKV("Collection", col.Name().Value())),
NewErrReplicatorDocID(err, dbErrors.NewKV("Collection", col.Name().Value())),
)
continue
}
Expand Down Expand Up @@ -650,7 +651,7 @@ func (db *db) retryDoc(ctx context.Context, docID string) (resErr error) {
if err != nil {
return err
}
defer func() { resErr = headsIterator.Close() }()
defer func() { resErr = errors.Join(resErr, headsIterator.Close()) }()

for {
select {
Expand Down

0 comments on commit 21269c1

Please sign in to comment.