Skip to content

Commit

Permalink
Fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
islamaliev committed Nov 5, 2024
1 parent 4f8eef9 commit 4ffbcb9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions internal/db/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package db

import (
"context"
"errors"
"sync"
"sync/atomic"
"time"
Expand All @@ -30,7 +31,7 @@ import (
"github.com/sourcenetwork/defradb/acp/identity"
"github.com/sourcenetwork/defradb/client"
"github.com/sourcenetwork/defradb/datastore"
"github.com/sourcenetwork/defradb/errors"
defraErrors "github.com/sourcenetwork/defradb/errors"
"github.com/sourcenetwork/defradb/event"
"github.com/sourcenetwork/defradb/internal/core"
"github.com/sourcenetwork/defradb/internal/db/permission"
Expand Down Expand Up @@ -275,12 +276,11 @@ func (db *db) publishDocUpdateEvent(ctx context.Context, docID string, collectio
if err != nil {
return err
}
defer headsIterator.Close()

for {
hasValue, err := headsIterator.Next()
if err != nil {
return err
return errors.Join(err, headsIterator.Close())
}
if !hasValue {
break
Expand All @@ -294,7 +294,7 @@ func (db *db) publishDocUpdateEvent(ctx context.Context, docID string, collectio
}
db.events.Publish(event.NewMessage(event.UpdateName, updateEvent))
}
return nil
return headsIterator.Close()
}

func (db *db) DeleteDocActorRelationship(
Expand Down Expand Up @@ -363,7 +363,7 @@ func (db *db) initialize(ctx context.Context) error {
}

exists, err := txn.Systemstore().Has(ctx, ds.NewKey("init"))
if err != nil && !errors.Is(err, ds.ErrNotFound) {
if err != nil && !defraErrors.Is(err, ds.ErrNotFound) {
return err
}
// if we're loading an existing database, just load the schema
Expand Down
4 changes: 2 additions & 2 deletions internal/db/p2p_replicator.go
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ func (db *db) retryReplicator(ctx context.Context, peerID string) {
}
}

func (db *db) retryDoc(ctx context.Context, docID string) error {
func (db *db) retryDoc(ctx context.Context, docID string) (resErr error) {
ctx, txn, err := ensureContextTxn(ctx, db, false)
if err != nil {
return err
Expand All @@ -650,7 +650,7 @@ func (db *db) retryDoc(ctx context.Context, docID string) error {
if err != nil {
return err
}
defer headsIterator.Close()
defer func() { resErr = headsIterator.Close() }()

for {
select {
Expand Down

0 comments on commit 4ffbcb9

Please sign in to comment.