Skip to content

Commit

Permalink
fix: send change events always (#119)
Browse files Browse the repository at this point in the history
Send change events to the change event channel always, instead
of only sending them if there was an error.
  • Loading branch information
rainest authored Aug 2, 2024
1 parent 61fbc91 commit 299110b
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions pkg/diff/diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 299110b

Please sign in to comment.