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

Events: Reusable events #310

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open

Conversation

martastain
Copy link
Member

@martastain martastain commented Aug 5, 2024

This PR introduces an optional reuse: bool = False parameter to the EventStream.dispatch function. When set to True, if an event with the same hash already exists in the event stream, the existing event will be updated, and its ID will be returned instead of raising an exception.

This enhancement simplifies scenarios where previously it was necessary to first query the event by its hash and, only if it was not found, create a new one.

As a demonstration of this new functionality, the handling of the addon.install event has been refactored to leverage the reuse parameter.

@martastain martastain linked an issue Aug 5, 2024 that may be closed by this pull request
@martastain martastain self-assigned this Aug 5, 2024
@martastain martastain added the type: enhancement Improvement of existing functionality or minor addition label Aug 5, 2024
@martastain martastain marked this pull request as ready for review December 5, 2024 08:58
@martastain martastain requested a review from iLLiCiTiT December 5, 2024 09:00
Copy link
Member

@iLLiCiTiT iLLiCiTiT left a comment

Choose a reason for hiding this comment

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

It works.

NOTE: I see advantage to know about all attempts to install addon? (Different issue and PR.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement Improvement of existing functionality or minor addition
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Events: Reusable events
2 participants