Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete stream destination filters when deleting a stream #20618

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

patrickmann
Copy link
Contributor

@patrickmann patrickmann commented Oct 2, 2024

/nocl unreleased
Resolves Graylog2/graylog-plugin-enterprise#7833

Add handler for stream deletion to StreamDestinationFilterService

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Refactoring (non-breaking change)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.

@patrickmann patrickmann requested a review from bernd October 2, 2024 08:51
@patrickmann patrickmann requested review from a team and kodjo-anipah and removed request for bernd October 2, 2024 09:01

@Subscribe
@SuppressWarnings("unused")
public void handleStreamDeleted(StreamDeletedEvent streamDeletedEvent) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we directly just deleted it? That shouldn't be coming from an api call, so I don't think there is any need to fetch the filter, verify if the filter matches the streamId before deleting it

    public void handleStreamDeleted(StreamDeletedEvent streamDeletedEvent) {
        collection.deleteOne(Filters.eq(FIELD_STREAM_ID, streamDeletedEvent.streamId()));

    }
    
    ````

Copy link
Contributor Author

@patrickmann patrickmann Oct 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Except, there can be more than one rule per stream. We should call deleteMany instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants