falcosecurity / plugin-sdk-go

Falco plugins SDK for Go
Apache License 2.0
26 stars 17 forks source link

plugin_next_batch should return success when batch < max batch size #7

Closed mstemm closed 3 years ago

mstemm commented 3 years ago

When using the NextBatch wrapper, NextBatch calls the provided next function until a non-SSPluginSuccess value is returned.

There was a bug in this, where a timeout from the underlying next function would be passed up to the framework, even if there were some pending events (think fewer than max batch size).

The fix is to change a timeout to success if there are any events to return.

Signed-off-by: Mark Stemm mark.stemm@gmail.com

What type of PR is this?

Uncomment one (or more) /kind <> lines:

/kind bug

/kind cleanup

/kind design

/kind documentation

/kind failing-test

/kind feature

Any specific area of the project related to this PR?

Uncomment one (or more) /area <> lines:

/area build

/area plugin-sdk

/area tests

What this PR does / why we need it:

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

Fix plugin_next_batch wrapper to properly return success when less than a full batch of events is returned.
poiana commented 3 years ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ldegio, mstemm

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[OWNERS](https://github.com/falcosecurity/plugin-sdk-go/blob/main/OWNERS)~~ [mstemm] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment
poiana commented 3 years ago

LGTM label has been added.

Git tree hash: 9bbf960449845ed36f558f70542a7905974a84dd