From 299110bb62012d8b68893f5e748a4fb21a85cf27 Mon Sep 17 00:00:00 2001 From: Travis Raines <571832+rainest@users.noreply.github.com> Date: Thu, 1 Aug 2024 20:30:59 -0700 Subject: [PATCH] fix: send change events always (#119) Send change events to the change event channel always, instead of only sending them if there was an error. --- pkg/diff/diff.go | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/pkg/diff/diff.go b/pkg/diff/diff.go index 11b9e75..0eb6a0a 100644 --- a/pkg/diff/diff.go +++ b/pkg/diff/diff.go @@ -681,18 +681,18 @@ func (sc *Syncer) Solve(ctx context.Context, parallelism int, dry bool, isJSONOu // sync mode // fire the request to Kong result, err = sc.processor.Do(ctx, e.Kind, e.Op, e) - if err != nil { - // TODO https://github.com/Kong/go-database-reconciler/issues/22 this does not print, but is switched on - // sc.enableEntityActions because the existing behavior returns a result from the anon Run function. - // Refactoring should use only the channel and simplify the return, probably to just an error (all the other - // data will have been sent through the result channel). - if sc.enableEntityActions { - actionResult.Error = err - select { - case sc.resultChan <- actionResult: - case <-ctx.Done(): - } + // TODO https://github.com/Kong/go-database-reconciler/issues/22 this does not print, but is switched on + // sc.enableEntityActions because the existing behavior returns a result from the anon Run function. + // Refactoring should use only the channel and simplify the return, probably to just an error (all the other + // data will have been sent through the result channel). + if sc.enableEntityActions { + actionResult.Error = err + select { + case sc.resultChan <- actionResult: + case <-ctx.Done(): } + } + if err != nil { return nil, &crud.ActionError{ OperationType: e.Op, Kind: e.Kind,