From 8c81916779e6cac6da75bc90187a082bdca81ca2 Mon Sep 17 00:00:00 2001 From: Jussi Maki Date: Thu, 11 Apr 2024 19:43:33 +0200 Subject: [PATCH] reconciler: Do not do WriteTxn on empty results 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 --- reconciler/incremental.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/reconciler/incremental.go b/reconciler/incremental.go index d575c19..7366631 100644 --- a/reconciler/incremental.go +++ b/reconciler/incremental.go @@ -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()