Skip to content

Commit

Permalink
PR FIXUP - Simplify executeMerge getHeadsAsMergeTarget block
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewSisley committed Nov 15, 2024
1 parent 473b681 commit 42997c2
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions internal/db/merge.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,19 @@ func (db *db) executeMerge(ctx context.Context, col *collection, dagMerge event.
}
defer txn.Discard(ctx)

var mt mergeTarget
var key keys.HeadstoreKey
if dagMerge.DocID != "" {
mt, err = getHeadsAsMergeTarget(ctx, txn, keys.HeadstoreDocKey{
key = keys.HeadstoreDocKey{
DocID: dagMerge.DocID,
FieldID: core.COMPOSITE_NAMESPACE,
})
if err != nil {
return err
}
} else {
mt, err = getHeadsAsMergeTarget(ctx, txn, keys.NewHeadstoreColKey(col.Description().RootID))
if err != nil {
return err
}
key = keys.NewHeadstoreColKey(col.Description().RootID)
}

mt, err := getHeadsAsMergeTarget(ctx, txn, key)
if err != nil {
return err
}

mp, err := db.newMergeProcessor(txn, col)
Expand Down

0 comments on commit 42997c2

Please sign in to comment.