Skip to content

Commit

Permalink
reconciler: Do not do WriteTxn on empty results
Browse files Browse the repository at this point in the history
If the incremental round found no work to do we don't need to
acquire the WriteTxn. This can happen when objects are updated
but are not marked pending (e.g. changes are being made that
do not need to be reconciled).

Signed-off-by: Jussi Maki <[email protected]>
  • Loading branch information
joamaki committed Apr 11, 2024
1 parent 33b817f commit 8c81916
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions reconciler/incremental.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,12 @@ func (round *incrementalRound[Obj]) processSingle(obj Obj, rev statedb.Revision,
}

func (round *incrementalRound[Obj]) commitStatus() <-chan struct{} {
if len(round.results) == 0 {
// Nothing to commit.
_, watch := round.table.All(round.txn)
return watch
}

wtxn := round.db.WriteTxn(round.table)
defer wtxn.Commit()

Expand Down

0 comments on commit 8c81916

Please sign in to comment.