Skip to content

Commit

Permalink
Fix decision log hang
Browse files Browse the repository at this point in the history
..by breaking out of loop if context is cancelled.

Fixes open-policy-agent#2792

Signed-off-by: Anders Eknert <anders.eknert@bisnode.com>
  • Loading branch information
anderseknert authored and patrick-east committed Oct 19, 2020
1 parent 9f4aed2 commit deb61d0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion plugins/logs/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ func (p *Plugin) flushDecisions(ctx context.Context, cancel context.CancelFunc)
defer cancel()

go func(ctx context.Context, cancel context.CancelFunc) {
for {
for ctx.Err() == nil {
ok, err := p.oneShot(ctx)
if err != nil {
p.logError("%v.", err)
Expand Down

0 comments on commit deb61d0

Please sign in to comment.